XenServer Powershell Snapins Not Loading

by admin

I recently had the need to do some reporting on a XenServer 6.0 environment, so thought I’d take a look at what was available through the XenServer 6.0 Powershell snapins. I’d installed it a while back, but hadn’t had the opportunity/time/reason to use it until today. However, when attempting to run it from the shortcut created on the start menu, I was met with the following error:

xenserver-pssnapin-error

Command ‘if ($(Get-ExecutionPolicy) -ne “Restricted”) { . . \Initialize-Environment.ps1 } else { Write-Warning “Execution Policy is set to Restricted. Some XensServer commands are disabled.” } ; ‘ could not be executed because some Windows PowerShell snap-ins did not load.

It seems the reason for this is that the shortcut uses the default PowerShell for the server it is run on. When attempting to run on a x64 platform (in this case Windows 2008 R2), it results in the error shown above. In order to get it working I had to run the Powershell executable from ‘syswow64’ rather than from the c:\windows\system32 directory:

xenserver-pssnapin-syswow64

From here you can run the XenServerPSSnapIn.bat file, which should now run successfully:

XenServerPSSnapIn-bat

For convenience, you might want to edit the shortcut so that the SysWow64 version of Powershell is called.


Keep up to date with new posts on Buildvirtual.net - Follow us on Twitter:
Be Sociable, Share!

Leave a Comment

*

Previous post:

Next post: