Get-WmiObject : called an interface that was marshalled for a different thread

When trying to use:

Get-WmiObject -ComputerName 10.0.0.x -Namespace root/cimv2 -Class __SystemSecurity -Credential "10.0.0.x\administrator"

I get results being returned.

When using:

Get-WmiObject -ComputerName 10.0.0.x -Namespace root/cimv2 -Class __SystemSecurity -Credential "DOMAIN\administrator"

I get the error message below:

Get-WmiObject : The application called an interface that was marshalled for a different thread. 

I have to use WMI due to some machines not having Powershell and I have to use a domain account.

There is no firewall in between as the query successfully runs with “10.0.0.x\administrator” credentials.

This is in a lab environment with machines setup for testing this specific use case, no firewall, icmp allowed, services are started.

Any advice or assistance will be great.

Thank you!

If i recall correctly, there’s no user in a domain called Administrator. Even when you do the first DCPromo to convert a server to a DC with active directory, the local administrator user isn’t available anymore.

Instead try creating a domain user, give it admin permission on the node and then use his credentials in the command.

Hi Arie,

I’ve also attempted this. Still no luck.

Its not the account. The first account in the domain is Administrator. Its in the Users container and gives similar permissions to being in the domain admins group. Domain controllers don’t have local accounts but all other machines in the domain do.

I tried running you WMI calls and they both worked - using local administrator and domain administrator and my account (member of domain admins). This was on Windows 2012 R2 running latest RTM version of PowerShell 5.0 What are you running?

Hi Richard,

I’m trying to run this as a domain admin on a remote machine.
Running queries from the AD machine to the remote machines.
Have you tried to run these queries against remote machines?

Can we see your script? This is a very odd error, and I’ve never seen it happen to anyone else before.

Hi Dave,

The script is pretty much the one liner for now. I need to get the domain user working. Once I achieve that with the simply query, then I will expand on this.

Get-WmiObject -ComputerName 10.0.0.x -Namespace root/cimv2 -Class __SystemSecurity -Credential "DOMAIN\administrator"

Wow… I have no idea. :\

Built a new machine that was added to the domain. This machine was not the server with AD on it. For some reason the script now works. I’m not sure where the issue was.