Push Install WPKG with Psexec

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

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

Const ADS_SCOPE_SUBTREE = 2
 
 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
 objRecordSet.MoveFirst
 
 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
         Next
         'Wscript.Echo "Path: " & StrOU
         textstream.WriteLine objRecordSet.Fields("Name").Value
     objRecordSet.MoveNext
 Loop
 textstream.close
 Wscript.Echo "Finished..."

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. http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

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

Download the WPKG Client http://www1.wpkg.org/files/client/stable/WPKG%20Client%201.2.1.msi

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 -h -u yourdomain\adminuser -p yourpassword @hosts.xml -d msiexec /i "\\yourserver\wpkg\WPKG Client 1.2.1.msi" /qb SETTINGSFILE=\\yourserver\wpkg\settings.xml

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

Warning: The hosts.xml does not have the same format as the wpkg-hosts.xml ! In fact it is a plain txt file with a computer name on each line.