18
Feb/100
Feb/100
Get Service Pack Levels of Servers via Active Directory
Script that queries Active Directory to retrieve Service Pack Levels (In this example only from Windows Server 2003 Machines)
Modify the strContainer variable to your requirements.
?Download GetServicePacks.vbs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | On Error Resume Next Const ADS_SCOPE_SUBTREE = 2 strContainer = "DC=yourdomain,DC=com" Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = ("ADsDSOObject") objConnection.Open "Active Directory Provider" objCommand.ActiveConnection = objConnection objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE objCommand.Properties("Page Size") = 1000 objCommand.CommandText = _ "SELECT CN, operatingSystem, operatingSystemVersion, operatingSystemServicePack FROM 'LDAP://" & strContainer & "' " _ & "WHERE objectCategory='computer' AND operatingSystem = 'Windows Server 2003' " Set objRecordSet = objCommand.Execute objRecordSet.Sort = "CN" objRecordSet.MoveFirst Do Until objRecordSet.EOF Wscript.Echo objRecordSet.Fields("CN").Value & "," & objRecordSet.Fields("operatingSystem").Value & "," & objRecordSet.Fields("operatingSystemVersion").Value & "," & objRecordSet.Fields("operatingSystemServicePack").Value objRecordSet.MoveNext Loop |
245 views
