Scripting. Powershell, VMware, Windows, Active Directory & Exchange. All that kind of stuff…..
RSS icon Email icon Home icon
  • Checking 32bit PowerShell Snapins from 64bit PowerShell

    Posted on July 18th, 2012 Jonathan Medd No comments

    In PowerShell you use Get-PSSnapin to view available third-party snapins for PowerShell on your system. However, some snapins may ship versions in 64bit, 32bit or both. If you install a 32bit snapin on a 64bit machine and then run Get-PSSnapin from 64bit PowerShell, only 64bit snapins will be displayed – which can lead to some initial confusion.

    Consider the following example of two 32bit snapins installed on a 64bit machine. 64bit PowerShell has no knowledge of them, but 32bit does.

    
    Get-PSSnapin -Registered
    
    

    If you want to check for 32bit snapins from 64bit PowerShell you can get round it by doing this, essentially calling 32bit PowerShell from 64bit:

    
    & "$env:Windir\SysWOW64\WindowsPowerShell\v1.0\powershell.exe" -command {Get-PSSnapin -Registered}
    
    

    Or you could use this simple function to check both 64bit and 32bit:

    function Get-AllPSSnapin {
    $64bitsnapins = Get-PSSnapin -Registered
    $32bitsnapins =  & "$env:Windir\SysWOW64\WindowsPowerShell\v1.0\powershell.exe" -command {Get-PSSnapin -Registered}
    $64bitsnapins + $32bitsnapins
    }
    

    Leave a reply