Invoke x86 Shell Session

Tagged: ,

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of Duffney Duffney 1 year ago.

  • Author
  • #31180
    Profile photo of Duffney

    How could I use invoke-command or a similar cmdlet to start a x86 session and then pass it a script to execute in a script block? I'm using a script that allows me to use the com object for the Active Directory Migration Toolkit and it needs to be elevated and running in a x86 shell session.

  • #31219
    Profile photo of Daniel Krebs
    Daniel Krebs

    You will need to open a new PSSession and specify the 32-bit session configuration as shown below:

    $s = New-PSSession -ConfigurationName microsoft.powershell32 -ComputerName localhost
    Invoke-Command -Session $s -ScriptBlock { $env:PROCESSOR_ARCHITECTURE }

    However with ADMT it will probably not work because you'll run into the second/double-hop scenario.

    Without using Remoting you can run a 32-bit PowerShell session locally with the following command:

  • #31244
    Profile photo of Tim Curwick
    Tim Curwick


    You can use this to have a script re-launch itself if it isn't running in the right type of session.

    Param ( [string]$YourParam1, [int]$YourParam2 )
    If ( [IntPtr]::Size * 8 -ne 32 )
        C:\Windows\SysWOW64\WindowsPowerShell\v1.0\PowerShell.exe -File $MyInvocation.MyCommand.Path -YourParam1 $YourParam1 -YourParam2 $YourParam2
        # Your code here

    You can read more about it here:

  • #31288
    Profile photo of Duffney

    Appreciate the replies, I ended up getting the 32bit session to work by using the session options. However, I ran into a runspace issue with ADMT. I don't fully understand it yet, but by invoking the command on the box it's not able to connect to the domain controller in the source domain. Error shown below, not sure how to get around that yet.

    Unable to migrate users. Cannot get name of domain controller holding the RID master role in domain
    ''. Access is denied.

You must be logged in to reply to this topic.