itgeek Posted November 28, 2012 Posted November 28, 2012 Hi I would like to scan the domain for a list of all computers in the domain and what os they are running. Does anybody have a script or program. Thanks
FN-GM Posted November 28, 2012 Posted November 28, 2012 Have a look at Spiceworks, its free and does the job well.
Dos_Box Posted November 28, 2012 Posted November 28, 2012 I shall also direct you to this article we did earlier: EduGeek.net - An EduGeek Roundup of Free Network Monitoring Tools please be aware though that none are 100 perfect at detecting all computers and devices although Spiceworks and the Dude are the two easiest to get up and running.
Devontechie Posted November 28, 2012 Posted November 28, 2012 Have a look at Spiceworks, its free and does the job well. I agree with giving Spiceworks ago. It is fairly easy to setup aswell. I have got it running on server at work which then has remote sites reporting back with the details of the computers/printers/IP phones etc. I have between 15 and 20 sites reporting back
ChrisMiles Posted November 29, 2012 Posted November 29, 2012 (edited) This script will output the information you requested from AD: On Error Resume Next ' Mehtod Constants Const adUseClient = 3 Const adCmdText = 1 Const adSecureAuthentication = 1 Const adLockReadOnly = 1 ' Declare Variables Dim shell, fso, adoConnection, adoCommand, adoRecordset Dim organisationUnit Dim textStream ' Set Configuration Variables organisationUnit = "DC=school,DC=local" ' Create System Objects Set shell = CreateObject("Wscript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") ' Ensure the script runs via cscript instead of wscript If Instr(1, WScript.FullName, "CScript", vbTextCompare) = 0 Then shell.Run "cscript """ & WScript.ScriptFullName & """", 1, False WScript.Quit End If ' Clear the error state Err.Clear '===================================================' ' Connect to Active Directory ' '===================================================' WScript.Stdout.Write "Connecting to Active Directory... " Set adoConnection = CreateObject("ADODB.Connection") adoConnection.Provider = "ADsDSOObject" adoConnection.Properties("Encrypt Password") = True adoConnection.Properties("ADSI Flag") = adSecureAuthentication adoConnection.Open "Active Directory Provider" If Err.Number <> 0 Then WScript.Stdout.WriteLine "Failed!" WScript.Stdout.WriteLine WScript.Stdout.WriteLine "Error: " & Err.Number & ": " & Err.Description WScript.Stdout.WriteLine WScript.Quit End If WScript.Stdout.WriteLine "Done." '===================================================' ' Open Output File ' '===================================================' WScript.Stdout.Write "Opening output file 'computers.csv'... " Set textStream = fso.CreateTextFile("computers.csv", true) If Err.Number <> 0 Then WScript.Stdout.WriteLine "Failed!" WScript.Stdout.WriteLine WScript.Stdout.WriteLine "Error: " & Err.Number & ": " & Err.Description WScript.Stdout.WriteLine WScript.Quit End If textStream.WriteLine("""Name"",""OS"",""OS Service Pack"",""OS Version""") If Err.Number <> 0 Then WScript.Stdout.WriteLine "Failed!" WScript.Stdout.WriteLine WScript.Stdout.WriteLine "Error: " & Err.Number & ": " & Err.Description WScript.Stdout.WriteLine WScript.Quit End If WScript.Stdout.WriteLine "Done." '===================================================' ' Query Active Directory for Computers ' '===================================================' WScript.Stdout.Write "Querying Active Directory for computers... " Set adoCommand = CreateObject("ADODB.Command") Set adoRecordset = CreateObject("ADODB.Recordset") adoCommand.ActiveConnection = adoConnection adoCommand.Properties("Page Size") = 1000000 adoCommand.Properties("Sort On") = "cn" adoCommand.CommandType = adCmdText adoCommand.CommandText = ";(objectCategory=Computer);name,operatingSystem,operatingSystemServicePack,operatingSystemVersion;subtree" adoRecordset.Open adoCommand, , adUseClient, adLockReadOnly If Err.Number <> 0 Then WScript.Stdout.WriteLine "Failed!" WScript.Stdout.WriteLine WScript.Stdout.WriteLine "Error: " & Err.Number & ": " & Err.Description WScript.Stdout.WriteLine WScript.Quit End If '===================================================' ' Process Computers ' '===================================================' WScript.Stdout.WriteLine adoRecordset.RecordCount & " Found." While Not adoRecordset.EOF And Not adoRecordset.BOF ' Write computer information textStream.Write("""") textStream.Write(adoRecordSet("name")) textStream.Write(""",""") textStream.Write(adoRecordSet("operatingSystem")) textStream.Write(""",""") textStream.Write(adoRecordSet("operatingSystemServicePack")) textStream.Write(""",""") textStream.Write(adoRecordSet("operatingSystemVersion")) textStream.WriteLine("""") adoRecordset.MoveNext Wend Err.Clear '===================================================' ' Close Active Directory Connection ' '===================================================' WScript.Stdout.Write "Closing Active Directory Connection... " adoConnection.Close If Err.Number <> 0 Then WScript.Stdout.WriteLine "Failed!" WScript.Stdout.WriteLine WScript.Stdout.WriteLine "Error: " & Err.Number & ": " & Err.Description WScript.Stdout.WriteLine WScript.Quit End If WScript.Stdout.WriteLine "Done." '===================================================' ' Close Output File ' '===================================================' WScript.Stdout.Write "Closing output file... " textStream.Close() If Err.Number <> 0 Then WScript.Stdout.WriteLine "Failed!" WScript.Stdout.WriteLine WScript.Stdout.WriteLine "Error: " & Err.Number & ": " & Err.Description WScript.Stdout.WriteLine WScript.Quit End If WScript.Stdout.WriteLine "Done." Edited November 29, 2012 by ChrisMiles
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now