Loading |
VBScript |
JavaScript |
Powershell |
Search Options: Search for Specific Computer AccountsContent of Search for Specific Computer Accounts.vbsMD5 Hash: 05C766DCCC7ACEF509D29844678651BD |
||
' Description: Returns the name and location for all the computers in the domain that are running Windows Server 2003.
Const ADS_SCOPE_SUBTREE = 2 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, Location, operatingSystemVersion from " & _ "'LDAP://DC=fabrikam,DC=com' where objectClass='computer'" & _ " and operatingSystemVersion = '5.1 (3600)'" 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 "Location: " & objRecordSet.Fields("Location").Value objRecordSet.MoveNext Loop | ||
© 2008 - 2013 Boris Toll :: Scripts available: 6.481 :: :: scriptbox.toll.at :: :: powered by www.toll.at :: |