I looked in the help about_requires I don’t see anything about requiring that the console be launched in 64bit mode. is there a hidden requires statement perhaps? or is there a module that is only loaded in 64 bit powershell but not 32 bit that is common across all or several the versions? On this site (http://www.nivot.org/blog/post/2012/12/18/Ensuring-a-PowerShell-script-will-always-run-in-a-64-bit-shell) I found this snippet (below) is there something easier?
if ($pshome -like "*syswow64*") {
write-warning "Restarting script under 64 bit powershell"
# relaunch this script under 64 bit shell
# if you want powershell 2.0, add -version 2 *before* -file parameter
& (join-path ($pshome -replace "syswow64", "sysnative") powershell.exe) -file `
(join-path $psscriptroot $myinvocation.mycommand) @args
# exit 32 bit script
exit
}
As far as I’m aware there isn’t a requires setting for 32/64 bit
Most modules run OK in both. I know that some parts of the VMware module only work in 32 bit
You can also test if running 32/64 bit like this
if ([System.IntPtr]::Size -eq 8) {$size = ‘64 bit’}
else {$size = ‘32 bit’}
The reason for the post was I ran into using this class from Dotnet and it couldn’t be loaded when using the 32bit shell:
$mgr = new-object Microsoft.Web.Administration.ServerManager
After searching further found out that the script that was being called was initially being run in the 32bit shell. So wondered if there was some way I could make sure that the user only used 64 bit version of the shell. That is what prompted this post.
Since this class is limited to instances of IIS I was looking for something that might have been in any 64 bit version of windows only…