Script Tips

Scripting Software Deployments

Why scripting makes for a poor software deployment tool.

A reader asks if there’s a way to install software from an MSI or Setup.exe on a remote computer. He suggests this code:

Set objShell = WScript.CreateObject("WScript.Shell")
strCommand = "\\server\app\Setup.exe" & strComputer
Set objExec = objShell.Exec(strCommand)

Unfortunately, this won’t work at all: It just results in your local computer trying to execute something like "\\Server\app\Setup.exeCLIENTA," if CLIENTA were the remote computer name.

The sad news is that VBScript isn’t a great tool for remote software deployment. Group Policy is, as is Microsoft Systems Management Server (SMS), but not VBScript. You could, in theory, use VBScript and WMI to remotely start a new instance of Win32_Process:

strComputer = "CLIENTA"
Set objWMIService = GetObject _
   ("winmgmts:\\" & strComputer & _
   "\root\cimv2:Win32_Process")
objWMIService.Create("setup.exe", null, null, intProcessID)

If you’re a local Administrator on the remote machine, that should work, but the Setup.exe will be invisible to the user of the machine and needs to be entirely automated or it’ll just "hang." waiting for input that’ll never arrive. The installation will run under your credentials on the remote machine, which is something to keep in mind.

About the Author

Don Jones is a multiple-year recipient of Microsoft’s MVP Award, and is Curriculum Director for IT Pro Content for video training company Pluralsight. Don is also a co-founder and President of PowerShell.org, a community dedicated to Microsoft’s Windows PowerShell technology. Don has more than two decades of experience in the IT industry, and specializes in the Microsoft business technology platform. He’s the author of more than 50 technology books, an accomplished IT journalist, and a sought-after speaker and instructor at conferences worldwide. Reach Don on Twitter at @concentratedDon, or on Facebook at Facebook.com/ConcentratedDon.

comments powered by Disqus
Most   Popular