SOLVED: ActiveDirectory PowerShell error "Get-GPO : Current security context is not associated with an Active Directory domain or forest"

When you run the GroupPolicy PowerShell cmdlet Get-GPO you get the following error:

Get-GPO : Current security context is not associated with an Active Directory domain or forest


The same thing happens if you run the Get-GPOReport cmdlet (and the fix is the same).


This can occur if the user who is executing the command is not a member of a domain - perhaps you are running the command using a runas /netonly from a workgroup machine.


To resolve this issue you can specify both the server name to use to process the request and the domain from which to read the Group Policy objects.

Get-GPO -Server "demo-xcs-2022.demoxcs2022.int" -Domain "demoxcs2022.int" -All


 While you're here -
Why not check out our Group Policy Audit and Documentation Tool?


Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Windows Server 2019 desktop icons such as My Computer, Windows cannot access the specified device, path, or file.