-1

I am looking for a script which will set the value to "Enable/Not Configured/Disable" of Allow Remote Shell Access in Gpedit via Powershell script.

Below value state value should get changed to Disable via PS script I know I can use get-gpo to change the status but when I run "Import-Module GroupPolicy" I got below error.

Import-Module : The specified module 'GroupPolicy' was not loaded because no valid module file was found in any module
    directory.
    At line:1 char:1
    + Import-Module GroupPolicy
    + ~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ResourceUnavailable: (GroupPolicy:String) [Import-Module], FileNotFoundException
        + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
asur
  • 101
  • 2
  • Please clarify what you are asking. You wrote you could not open gpedit but prior to that you wrote steps that seem to imply you successfully opened gpedit. Your question says you are using PowerShell version 5.0 but you also tagged your question using different PowerShell versions. Please re-write your question. – user5870571 Mar 09 '18 at 18:20
  • @user5870571-- Changed the question – asur Mar 09 '18 at 18:28

2 Answers2

1

Your edits still don't clarify your question.

I'm going to try to answer what I understand your question to be. If my answer is not related to what you are trying to ask then please go back and clarify your question.

This looks like you may have installed RSAT but not enabled it in Control Panel. Please verify you have done each of the following:

  • Install RSAT
  • Restart your computer
  • Open Control Panel
  • Open Program and Features
  • Click "Turn Windows features on or off"
  • Enable RSAT
  • Open PowerShell
  • Run Import-Module GroupPolicy
user5870571
  • 3,094
  • 2
  • 12
  • 35
0

You need to load the ActiveDirectory cmdlet set, like so:

import-module ActiveDirectory

If you don't have them, later versions of powershell come with NuGet which lets you install them without installing the entire RSAT toolkit:

install-module ActiveDirectory

You should now be able to run Get-GPO.

Nathan C
  • 15,059
  • 4
  • 43
  • 62