Skip to content

Instantly share code, notes, and snippets.

@jstangroome
Created February 10, 2011 03:45
Show Gist options
  • Save jstangroome/819902 to your computer and use it in GitHub Desktop.
Save jstangroome/819902 to your computer and use it in GitHub Desktop.
Detect 32-bit PowerShell inside a script and switch to 64-bit PowerShell via PS Remoting
if (Test-Path Env:PROCESSOR_ARCHITEW6432) {
Write-Host "Switching to 64-bit PowerShell"
Invoke-Command -ComputerName localhost -ScriptBlock {
param ($Path, $Parameters)
& $Path @Parameters
} -ArgumentList $MyInvocation.MyCommand.Path, $PSBoundParameters
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment