VBS Script to install software remotely

The following script has been used to remotely install Adobe Flash on a list of computers.


  • The pstools need to be installed on the main computer you’re running it from. The pstools can be found here http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx
  • A text file called MachineList.txt. Each computer name needs to be entered into a new line.
  • The installer file, for example install_flash_player_10_active_x.msi


To use, change the StrInstallFile and StrInstallCMD as required.
The install file needs to placed with the VBS file and will copy to the remote computer before running.

On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("MachineList.Txt", 1)

StrInstallCMD="msiexec.exe /qn /norestart /i C:\Windows\TEMP\install_flash_player_10_active_x.msi"

Do Until objFile.AtEndOfStream

strComputer = objFile.ReadLine

' --------- Check If PC is on -------------
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshExec = WshShell.Exec("ping -n 1 -w 1000 " & strComputer) 'send 3 echo requests, waiting 2secs each
strPingResults = LCase(WshExec.StdOut.ReadAll)
If InStr(strPingResults, "reply from") Then

' ---------- Successful ping - run remote commands ----------------

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

WshShell.Exec "%COMSPEC% /C COPY " & StrInstallFile & " \\" & strComputer & "\C$\Windows\TEMP", 0, TRUE
WshShell.Exec "%COMSPEC% /C psexec \\" & strComputer & " " & StrInstallCMD &"", 0, TRUE


' ---------- Unsuccessful ping - Leave computer name in MachineList.txt and continue ----------------

strNewContents = strNewContents & strComputer & vbCrLf

End If


Set objFile = objFSO.OpenTextFile("MachineList.txt", 2)
objFile.Write strNewContents


Related Articles

2 comments on “VBS Script to install software remotely

  1. Does this method require the users to have Admin rights on their local machines? I noticed that you used the -qn option to suppress the progress window. If you use -passive and a user is logged in, will the user on a target machine observe the installation progress window?

Leave a Reply

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