Difference between revisions of "Push Install WPKG with Psexec"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
m (save)
 
Line 1: Line 1:
Save
+
It is usefull 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)
 +
 
 +
***********Script*************
 +
 
 +
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..."
 +
 
 +
************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. 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 clientt 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 -y yourdomain\adminuser -p yourpassword @hosts.xml -s -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 :)

Revision as of 18:32, 17 December 2008

It is usefull 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)

                      • Script*************

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..."
                        • 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. 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 clientt 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 -y yourdomain\adminuser -p yourpassword @hosts.xml -s -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 :)