Yes, I know, there other methods to deploy applications, but sometimes it make sense to use SCVMM to deploy applications to the host machines that you manage. If we look on this from a new and more modern way, SCVMM will be the System Center member that does the deployment of the “only” needed physical machines, that is the Hyper-V hosts and the fileservers used to store the VHDx files over the the SMB network, maybe there is no Configuration Manager Server in this datacenter for any reason.
The App = HP Service Pack
In this case we are going to deploy the HP Service Pack to our hosts since we need that to be able to monitor correctly using OpsMgr (When using an Agent) amongst many things. The Application can be “pushed” from a central location but in this case we are going to run the application locally on each and every server and reboot it if needed. The Command to make a silent express install is HPSUM.exe /express_install and you download the Service Pack for the Proliant servers from HP.com (https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPICE#Download). After downloading the ISO, mount and extract and share the folder so it is accessible to all your hosts.
The GUI Method
Rater easy actually, we can use the “Run Script Command” that is available on every server in the SCVMM Console and then fill out all the parameters
Fill out the parameters like this:
-Executable program: \\vmm01\CD\hp\swpackages\hpsum.exe
–Standard Output: Do not match
–Standard error: Do not match
–Exit Code: Do not Match
–Action when matched: Warn and Continue
–Job restart action: Ignore Script
–Always restart after the script has finished running: Checked
–Restart the computer or virtual machines if the specified exit code is returned: Unchecked
Summary using the UI:
This will work, but not they way I wanted it to, the problem is that I cannot define my own values in the dialg boxes, as an example the application HPSUM.exe will return exit code 1,2 or 3 when it needs a reboot and that cannot be “picked” in the dropdown list, however, using PowerShell well be easier, better and faster since you can define all the applications in an XML file wit all the different settings. so lets drop the UI and switch over to what works and make sense, PowerShell :-)
The PowerShell Method
In this case we will use the same engine, but fire it of using PowerShell instead, it gives us more flexibility and more control
Step Number One – Create the Apps.XML
Here we create an XML file that contain all the settings for all the different application we would like to deploy and here it how it looks:
as you can see it contains the application, arguments, reboot settings and all the return codes this application could return when it “feels” that it needs a reboot
Step Number Two – Create the Deploy-Apps.ps1 script
The script uses the Parameter function to read in data from the command line and then it reads the XML file, we also need to make sure that some of the data from the XML file is parsed correctly as strings or as Boolean. Then we use all that data set some static settings and last we use the Invoke-SCScriptCommand to execute the command on the host, the script looks like this:
Step Number Three – Execute!
Execute the script like this:
And wait for the job in the log and after a while it will inform you that the job did finish with warnings, the reason for the warning is that is actually a real warning from the application that is picked up up by the output :-)
The hpsum.exe detects the version of windows as 6.2 (and that is correct), but even if HP claims that is supported, the HPSUM.exe does not have the same opinion :-). Hopefully HP will fix this later.
So in the Job log it will show up like this:
Summary using PowerShell:
This gives a more stable solution which can be extended and automated and that I like…