Last week I posted about using a PowerShell script to automate VM cluster maintenance, and talked about how the VMM PowerShell snap-in is 64-bit, while Opalis is 32-bit (and therefore runs PowerShell in 32-bit mode). I thought I would take a second and create a separate post on this to call this out specifically because it's important, it's already being asked about, and will likely be a source of confusion unless you know about it before you try it.
If you're running Opalis on a 64-bit OS like Windows Server 2008 R2 (like I do), and you install the PowerShell ISE, you'll notice that you get two versions – one for 64-bit and one for 32-bit (x86).
The key thing for you to remember is that you should always test your PowerShell scripts by running them on your Opalis server using the x86 version of the PowerShell console or ISE. This will put you in the same environment that Opalis will use for running the script, and you will have the same issues that Opalis would have in running 32-bit mode against 64-bit snap-ins. The tell-tale sign of the 32-bit/64-bit problem is trying to load a snap-in and it doesn't show up. Switching over to the 64-bit ISE and showing the snap-ins ("Get-PSSnapIn") will likely show the snap-in to confirm the issue. If you have a 32-bit/64-bit issue, there are two potential ways to get around it:
If you want to continue to loop back to the Opalis server first, then you will have to enable and use CredSSP during the remote sessions. If you want to find out more about the CredSSP topic, you can check out these links:
Just to repeat the example I gave previously, here's a script I would use to connect from Opalis to a VMM server and use the 64-bit environment to run a script:
Note that I am using variables (though I'd probably use Custom Start parameters in the actual workflow. I am also using try/catch to throw exceptions so Opalis will stop the workflow if an error occurs (normally it will show success regardless of the outcome).
Be sure to check out Making Custom Objects and Integration Packs using PowerShell Scripts for more details on using PowerShell on Opalis (specifically in QIK CLI).
if you connect to vmm for example but are using a remote SQL-Database then the connection will also fail due to the credssp-story