SCCM PowerCLI Silent deployment script

A couple of months ago I was asked by a client to create a method of patching to automatically snap shot a VM before applying the monthly patches with SCCM.

This as I’m sure your thinking has to be done by Task Sequence with the use of SCCM. If you not then that is how I would suggest you do it. The issue was PowerCLI and how to deploy that silently to all servers to allow for the Task Sequence to harness the PowerShell commands locally on the box without using remote PowerShell. I came across a great blog here discussing the silent install and then decided to write a PowerShell wrapper to deploy the software silently and with the use of SCCM.

The following script can be run as an Application or Package that is purely up to you. There are 2 modes, Install and Uninstall. Add these deployment command lines to your application or program to silently install PowerCLI or just run them locally:

Powershell.exe -Executionpolicy Bypass -File "Deploy_PowerCLI_Silent.ps1 -MODE Install"
Powershell.exe -Executionpolicy Bypass -File "Deploy_PowerCLI_Silent.ps1 -MODE Uninstall"

You will probably notice that to uninstall it silently you need to remove “VMware Remote Console Plug-in 5.1” followed by the “VMware vSphere PowerCLI” software.
The script build the arguments to do so, but if you are using a different version you will have to change:

$RemConsole = $InstalledProducts | where { $_.ARPDisplayName -eq "VMware Remote Console Plug-in 5.1" }

name to match
Just change the “VMware Remote Console Plug-in 5.1” portion to the same text as seen in your “Programs and Features” (Appwiz.cpl).
Make sure the VMware-PowerCLI.exe is in the same folder as the script.
The Script:

2 Replies to “SCCM PowerCLI Silent deployment script”

  1. May I see the script you used in order to backup the vm? I’m assuming you had a device collection with all of the machines. In the task sequence you had the first step create a Snapshot, and then the 2nd step run the updates. Could we see the script you used to create the snapshot?

    1. Hi SCCM Guy,

      Yes I had all my device collections for Pilot and Production patching. Also I normally split them out by Manual or ADR. Manual being deployed as Available, which this script was used in harmony with. I will do a guide on how I setup ADR rules which means patching is reduced to “Right click…. Enable”.
      Any way here is the snapshot script for you.

      Auto Snapshot VM before Patching

      Cheers,

      SCCMOG

Leave a Reply

Your email address will not be published. Required fields are marked *