Changes

Jump to: navigation, search

WPKG with Active Directory

2,021 bytes added, 18:18, 7 July 2007
m
Reverted edit of 202.28.27.3, changed back to last version by WPKGSysop
e.g. '''Computer Configuration -> Administrative Templates -> System -> Scripts'''
Make sure that "'''Startscripts asynchron ausf�hrenausführen'''" is set to "'''Aktiviert'''"
e.g. '''Apply Startup scripts asynchronously''' is set to '''enabled'''
It's a good choice, because some unpatient users will just press Reboot button when they can't log in immediately, which can have unexpected results (software not installed properly etc.).
Next thing to set is setting "'''Maximale Wartezeit f�r für Gruppenrichtlinienskripts'''" (Maximum wait time for Group Policy scripts). Default is 600 seconds (10 minutes), which can be often not enough for installing some software, or when you install more than one software package. So a safe bet is 1800 seconds (30 minutes).
# generate hosts.xml from AD
01 * * * * root perl /opt/ldap-wpkg.pl&>/dev/null = Pulling workstation names to hosts.xml from Active Directory OUs automatically with vbScript=This script takes out all computer objects from your whole Active directory Tree, and writes the OU in the hosts.xml Const ADS_SCOPE_SUBTREE = 2 set fs = CreateObject("Scripting.FileSystemObject") set textstream = fs.CreateTextFile("hosts.xml", True) textstream.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf textstream.WriteLine "<!-- automagically generated with " & Wscript.ScriptFullName textstream.WriteLine " Date: " & Date() & " -->" & vbCrLf & vbCrLf textstream.WriteLine "<wpkg>" 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 vbTab & "<host name=""" & objRecordSet.Fields("Name").Value & """ profile-id=""" & StrOU & """ />" objRecordSet.MoveNext Loop textstream.WriteLine "</wpkg>" textstream.close Wscript.Echo "Finished..." [[category:Documentation]][[category:Installation]]

Navigation menu