New-Object -Type Microsoft.GroupPolicy.GPDomain fails when run remotely

0

I am trying to run a script remotely (via vRO - essentially WinRM invoke), and am running into an issue with getting some commands to run.

I have two DCs: PRIDC and SECDC.

The command I'm having issues with:

$gpDomain = New-Object -Type Microsoft.GroupPolicy.GPDomain  

It works when run manually on either server, or when run remotely against PRIDC. Either way, it shows PRIDC as being the domain controller. When run remotely against SECDC, I get the following error:

New-Object : Exception calling ".ctor" with "0" argument(s): "An operations error occured. (Exception from HRESULT: 0x80072020)"

I suspect that this is due to Powershell's "double-hop" problem.

The main use of this is to get WMI filters via $gpDomain.GetWmiFilter($path)

Is there any way to force the initial query to be against SECDC, or another way to get the WmiFilter object without running into the double-hop problem?

powershell
active-directory
asked on Stack Overflow May 16, 2019 by Edward Barton

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0