Citrix PVS comes with the mcli.exe which allow users to write Windows batch file to automate some PVS operations. For those (like me) who prefer to use PowerShell can use the MCLIPSSnapin. This snapin provides several cmdlets that does the same thing as mcli.exe.

The snapin comes with the Provisioning Services Console. To use the snapin, you have to first register it (requires .Net framework). If your Windows is 32bits, use this command:

“C:\Windows\Microsoft.NET\Framework\v2.0.50727\installutil.exe” “C:\Program Files\Citrix\Provisioning Services Console\McliPSSnapIn.dll”

For 64bits:

“C:\Windows\Microsoft.NET\Framework64\v2.0.50727\installutil.exe” “C:\Program Files\Citrix\Provisioning Services Console\McliPSSnapIn.dll”

If you encountered error, make sure that you are running the Command Prompt as administrator.

Once registered, start a PowerShell console and add the snapin using “add-PSSnapIn mclipssnapin”. The main cmdlets are mcli-run, mcli-get, mcli-set and mcli-delete. To get a detailed help on the cmdlets, use mcli-help.

Some examples:

Setup a connection:
MCLI-Run setupconnection -p server=<PVSHOSTNAME>,port=<PVSPORT>

Add existing vDisk to store:
MCLI-Add diskLocator -r diskLocatorName=”VDISKNAME”,siteName=”SITENAME”,storename=”STORENAME”

Get devices from collection:
MCLI-Get Device -p collectionName=”COLLECTIONNAME”,siteName=”SITENAME”

For a detailed reference, check out the PVS 5.6 SP1 PowerShell Programmer’s Guide.