Get-GPO:How to Get list of Group Policy in your Environment using Powershell
GET-GPO is a very powerfull Command.It gets list of all GPO in your Domain.
To get a list of all GPO, thep
GET-GPO
You will get the below error
PS C:\Users\foxsha> GET-GPO
The term 'GET-GPO' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spe
lling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:8
+ GET-GPO <<<<
+ CategoryInfo : ObjectNotFound: (GET-GPO:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The reason for this error is that there is no Module Available for Active Directory
So first Import the Module using Command
Import-Module "grouppolicy"
You will see the below error
PS C:\Users\foxsha> Import-Module "grouppolicy"
Import-Module : The specified module 'grouppolicy' was not loaded because no valid module file was found in any module
directory.
At line:1 char:14
+ Import-Module <<<< "grouppolicy"
+ CategoryInfo : ResourceUnavailable: (grouppolicy:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
The resaon for this error is that there is no Group policy Feature installed so first we need to install the group policy features
If you are on your desktop and not on Server,you need to go to below location and download and install it
Then go to Programs and Features in Control Panned .Click "Turn Windows Feature On or OFF " and select "Group policy management"
Now try " Import-Module "grouppolicy" and then GET-GPO and it will run sucesfully
No comments:
Post a Comment