James O'Neill's Blog

June 16, 2008

How to get PowerShell snapins to work on 64 bit

Filed under: How to,Powershell — jamesone111 @ 12:05 am

I mentioned a problem with 64bit Powershell in my previous post: 3 snap-ins I’ve wanted to use have been packed for 32 bit and didn’t work "out of the box" on 64 bit, so  I thought I’d give a generic guide to making snapins work on 64bit.

  • Install the the Snapin using what
  • ever tools the writer gave you, Under the hood this will invoke
    C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe "<PathToDll>"
  • Start Powershell AS ADMINISTRATOR and use the command
    Get-PSSnapin -Registered | fl name, modulename
  • If you don’t see your new snap in on 64 bit run the command
    C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "<PathToDll>"
    Things to note. First. This will fail if you don’t have admin powers, Second if you don’t know the path to the DLL use the same get-psSnapin command in the 32 bit version.
    After you have got success messages from installUtil , for a second time run
    Get-PSSnapin -Registered
  • Be aware that the name you get when you run the command in 32 bit may not be same in 64 bit. I found this trying the Windows Mobile Provider from Codeplex It’s called "PSMobile" in 32 bit and "Nivot.PowerShell.WindowsMobile" in 64 bit . The PowerShell Community Extensions use the same name – PSCX – on both.
  • Load the Snapin with 
    Add-PsSnapin "<SnapInName>"

I got an error that the WindowsMobile provider could not find  WindowsMobile.formats.ps1xml in the FormatData folder , so I made the folder and copied the file into it. I think the set-up configures one folder and the command line assumes another.

This post originally appeared on my technet blog.

Advertisements

Blog at WordPress.com.

%d bloggers like this: