I was tasked to create a script where I can automated the configurations of group policy objects (GPO) using PowerShell. I'm creating a new GPO using this command:
New-GPO -Name "foo"
But, whenever I try to create a new GPO, I always encounter this error:
New-GPO : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
At line:1 char:1
+ New-GPO -Name "foo"
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-GPO], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.GroupPolicy.Commands.NewGpoCommand
I searched for the error code behind this, and it has something to do with the authorization of access behind this. I tried many things like downloading RSAT and other applications, but still, I can't allow my user to create a new GPO. Any help would be greatly appreciated. Thanks in advance.