Relaunching PowerShell as x64 if invoked from x86 I thought this might be handy for the community. Our management software is x86 only, and I frequently need to write to the x64 registry, or otherwise invoke x64 powershell. I came up with this code snippet. It essentially relaunches powershell as 64 if originally invoked 86, then finishes executing. Handy to avoid things like registry reflector. Any improvements welcome, but it should be fairly straight forward.

      if ($PSHOME -like "*syswow64*") {
        Write-Output "Relaunching"
        &amp; (Join-Path ($PSHOME -replace "syswow64", "sysnative") powershell.exe) `
            -File $Script:MyInvocation.MyCommand.Path `
            @args
        Exit
    }
    # Begin Script  