Citrix PVS is a great system but PVS Console is sometimes not enough to do some tasks. That’s why Citrix published PowerShell SnapIn for PVS. It’s not perfect but it help us to automate our work. So let’s begin with installation.
Documentation: Provisioning Services 7.1 PowerShell Administrator’s Guide
To do it you have to install Citrix PVS Console on a server where you want to use PoSH snapin. My PVS infrastructure was installed on Windows 2012R2. In manual we can find how to install it using .NET Framework 2.x. I wanted to do this using Framework 4.x.
As you can see I got many errors. Here is the command I used to install this module:
PS C:\Program Files\Citrix\Provisioning Services Console> C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe McliPSSnapIn.dll
And how it looks in PoSH console windows:
In the next step you have to import SnapIn to PowerShell:
PS C:\Program Files\Citrix\Provisioning Services Console> Add-PSSnapin -Name McliPSSnapIn
Now we are ready to make a connection to PVS Server (without parameters if you are executing it on PVS Server):
PS C:\Program Files\Citrix\Provisioning Services Console> Mcli-Run SetupConnection Run succeeded.
Where are addition parameters for SetupConnection command:
Mcli-Run SetupConnection -p name=value[, name2=value2] Setup the SOAP server connection that will be used for the MCLI and PowerShell command line interfaces. -p Parameters needed for this Run. Optional server Server used for the connection. Default=localhost port Port used for the connection. Default=8000 user User used for the connection. Default=Current user domain User domain used for the connection. Default=Current user password User password used for the connection. Default=Current user
So let’s try if we can show help for specified command:
PS C:\Program Files\Citrix\Provisioning Services Console> Mcli-Help Get Device
Right now we are ready to use PowerShell to script tasks in PVS. I will show how to do this in next post.
If you happen to be using PowerShell 2.0 and a more recent version of PVS, like 7.6.2 (versus 7.6.0 which works as above) then you should note that PoSH 2.0 defaults to the 2.x framework. You have to take extra steps to get it to leverage the 4.x framework. See http://viziblr.com/news/2012/5/16/the-easy-way-to-run-powershell-20-using-net-framework-40.html
Thanks for the above post BTW.