Deployment

Nice to Know–Deploying Applications using System Center Virtual Machine Manager 2012 (SP1/R2) in UI or in PowerShell

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

image

Fill out the parameters like this:

-Executable program: \\vmm01\CD\hp\swpackages\hpsum.exe

-Parameters: /express_install

-Timeout: 1800

-Advanced:

–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

image

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:

image

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:

image

Step Number Three – Execute!

Execute the script like this:

image

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.

image

So in the Job log it will show up like this:

image

Summary using PowerShell:

This gives a more stable solution which can be extended and automated and that I like…

You can download the scripts from here:

4 replies »

  1. Hi Mikael –

    This looks like a nice way to automate hpsum to install all the required drivers and packages on an HP host. The one question I have is around getting all of the packages, I find that when you use hpsum on a recently deployed host you usually need to run it, reboot and then run it one more time because all of the packages did not get installed the first time around. I notice that in your Apps.xml file there is an option for RestartScriptOnExitCodeReboot, if this was set to true would it restart the script once the host reboots and keep doing so until hpsum doesnt come back with a reboot exit code? This way all drivers / packages / firmware would get installed if it required a couple of passes.

    Thanks!

    -Nick

    • Yes, that should work, but the most common reason for the “update x2 or more” issue is that in the first run there is drivers missing, like ILO or similar. So by making sure all the drivers that really means something, Storage, Nic, ILO and such gets injected during the deploy, you only need to run it once.

      • Thanks Mikael –

        I will look into having these drivers inside of the VMM Library so it injects via Plug N Play ID’s during the deployment of the host. Hopefully that will help us out so we dont have to run it twice.

        -Nick

      • Instead of hoping that PnP will work, it is better to create profiles, you can do one for all HP servers, that way all the drivers will be forced to download and injected, that is a better method, PnP is still a pain…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.