Author Posts

June 7, 2016 at 10:33 pm

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 ( 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

June 8, 2016 at 11:04 am

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'}

June 8, 2016 at 3:21 pm

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..

June 8, 2016 at 3:39 pm


June 8, 2016 at 3:43 pm

nice... thanx Don