Push Installing WPKG using PSEXEC

It is useful to first grab a list of all of the computers in your domain. This vb script will do so (copy and past it into notepad and then save as getcomputers.vbs) Then execute it to generate a hosts.xml file.



set fs = CreateObject(“Scripting.FileSystemObject”)
set textstream = fs.CreateTextFile(“hosts.xml”, True)
Set rootDSE = GetObject(“LDAP://RootDSE”)
domainContainer =  rootDSE.Get(“defaultNamingContext”)

Set objConnection = CreateObject(“ADODB.Connection”)
Set objCommand =   CreateObject(“ADODB.Command”)
objConnection.Provider = “ADsDSOObject”
objConnection.Open “Active Directory Provider”

Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
“Select Name, distinguishedName from ‘LDAP://” & domainContainer & “‘ ” _
& “Where objectClass=’computer'”
objCommand.Properties(“Page Size”) = 1000
objCommand.Properties(“Searchscope”) = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute

Do Until objRecordSet.EOF
‘Wscript.Echo “Computer Name: ” & objRecordSet.Fields(“Name”).Value
‘Wscript.Echo “distinguishedName: ” & objRecordSet.Fields(“distinguishedName”).Value
arrPath = Split(objRecordSet.Fields(“distinguishedName”).Value, “,”)
strOU = “”
for each a in arrPath
if left(a,2) = “OU” Then
strOU = “/” & right(a,len(a) – 3) & strOU
End If
‘Wscript.Echo “Path: ” & StrOU
textstream.WriteLine objRecordSet.Fields(“Name”).Value
Wscript.Echo “Finished…”

************End Script***************

Ok, so that will save a file called hosts.xml. Edit it to remove any computer names that you don’t want to install WPKG on. Copy this file to your root c:

Download PStools.

To make it easy, install it to the root of your c: drive.

Download the WPKG clientt

and copy it over to a remote share. Also, copy over your settings file to the same remote share.

When you are ready to install, execute this psexec command: (Replacing yourdomain, adminuser, yourpassword, and yourserver with your values)

c:psexec -u yourdomainadminuser -p yourpassword @hosts.xml -s -d msiexec /i “yourserverwpkgWPKG Client 1.2.1.msi” /qb SETTINGSFILE=yourserverwpkgsettings.xml

This will then install WPKG on any of these clients that happen to be on at the time 🙂