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

This topic contains 8 replies, has 4 voices, and was last updated by Profile photo of Rivaan Bechan Rivaan Bechan 8 months, 2 weeks ago.

  • Author
    Posts
  • #36819
    Profile photo of Rivaan Bechan
    Rivaan Bechan
    Participant

    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!

  • #36820
    Profile photo of Arie H
    Arie H
    Participant

    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.

  • #36823
    Profile photo of Rivaan Bechan
    Rivaan Bechan
    Participant

    Hi Arie,

    I've also attempted this. Still no luck.

  • #36826
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    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?

  • #36831
    Profile photo of Rivaan Bechan
    Rivaan Bechan
    Participant

    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?

  • #36837
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

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

  • #36842
    Profile photo of Rivaan Bechan
    Rivaan Bechan
    Participant

    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"
  • #36849
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Wow... I have no idea. :\

  • #37074
    Profile photo of Rivaan Bechan
    Rivaan Bechan
    Participant

    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.

You must be logged in to reply to this topic.