Skip to content →

How to Deploy Software using NMTools

software-installOn a previous article I showed some of the possibilities that PLEX modules introduced for our dayly tasks. I did consciously omitted any reference to software deployment at that moment for a number of reasons. The main one was that I consider this subject important enough to deserve its own chapter.

Deploying software can be achieved with regular modules, PLEX modules and, for those cases where complex conditions need to be considered when deploying one package, you can use the new DynX modules.

DynX modules are a new feature that will be delivered on the next OpenSLIM release. They will help with complex situations that previously was not possible to handle: run-time conditional module execution, run-time module dependency management and run-time condition detection.

I must admit that NMTools, as many commercial solutions on this field, behaves only as a transport tool. The hard stuff is done by the packaging software or by the Windows Installer service. Some of them, to name a few, are traditional File Packaging Tools (ZIP, GZip, BZip, RAR, etc.), Flexera Software InstallShield, Symantec Wise Installation Studio or VisualStudio Installer. Therefore, it becomes unavoidable to have any kind of expertise with these products and technologies in order to master in this questions.

Fortunately, the usage pattern is the same no matter the packaging product you are using. Let's see some examples:

Deploying with PLEX modules

Install an InstallShield package on your Production Nodes and save the status of the operation:

"\\MyServer\MyShare\setup.exe -s -f1\\MyServer\MyShare\setup.iss -f2c:\MySetUp.log" | .\nmagent.ps1 -profile plex -cmd exec -src file .\settings\AllProductionNodes.txt -save

Conversely, the uninstall procedure would look like this:

"\\MyServer\MyShare\setup.exe -s -f1\\MyServer\MyShare\uninstall.iss -f2c:\MySetUp.log" | .\nmagent.ps1 -profile plex -cmd exec -src file .\settings\AllProductionNodes.txt -save

As you may have noticed, everything relies on the use of unattended installation files of that package: setup.iss and uninstall.iss on this example.

What about massively deploying the brand new Windows Management Framework? It would be a nice example of how Microsoft packages usually behave. But, remember, things change and may not be always the same.

Getting the command-line paramenters:

WindowsXP-KB968930-x86-ENG.exe /h

And, finally, deploying the software…

"\\MyServer\MyShare\WindowsXP-KB968930-x86-ENG.exe /quiet /norestart /log:C:\KB968930.log" | .\nmagent.ps1 -profile plex -cmd exec -src file .\settings\WinXP_ProductionNodes.txt -save

Building your own regular module

If this task will belong to the regular maintenance operations it may deserve its own module to make things easier. To achieve this you can follow this steps:

  • Create the module taking Xtras_RunWinCmd.ps1as your source and rename it into something meaningful to you:
    • Xtras_RunWinCmd_YourApp.ps1
  • Rename the function name into something meaningful to you:
    • Xtras_RunWinCmd_YourApp
  • Update the content of the $PsExecPayLoadvariable accordingly:
    • $PsExecPayLoad    = "`"\\MyServer\MyShare\setup.exe -s -f1\\MyServer\MyShare\setup.iss -f2c:\MySetUp.log`””
  • Update the profile settings file accordingly: settings-xtras.ps1
    • Xtras_RunWinCmd_YourApp = $true,  $false, $true, 'System', 'Xtras_RunWinCmd_YourApp';

Once you've done this, you are ready to go with your brand new module:

PS C:\> .\nmagent.ps1 -profile xtras -cmd exec -src file .\settings\AllProductionNodes.txt -save

And that's all! Easy, isn't it? Anyway, as soon as DynX feature is released we will revisit this subject so that we can see how you can handle more complex scenarios.

So, stay tuned! :D

How to Deploy Software using NMTools by Carlos Veira Lorenzo is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Published in Automation Projects System Management