Here's an example of a fairly simple VBScript that will create a spreadsheet
and list all the computers (plus their details) below a given level. You
should be able to tweak it to give you the information you need.
Tony
set objExcel = WScript.CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.ActiveSheet.Name = "Domain Computers"
objExcel.ActiveSheet.Range("A1").Activate
objExcel.ActiveCell.Value = "cn" 'col header 1
objExcel.ActiveCell.Offset(0,1).Value = "OS" 'col header 2
objExcel.ActiveCell.Offset(0,2).Value = "OS-ver" 'col header 3
objExcel.ActiveCell.Offset(0,3).Value = "OS-SP" 'col header 4
objExcel.ActiveCell.Offset(0,4).Value = "Description" 'col header 5
objExcel.ActiveCell.Offset(0,5).Value = "whenCreated" 'col header 6
objExcel.ActiveCell.Offset(1,0).Activate 'move 1 down
strADsPath = "<LDAP://DC=myco,DC=com>;"
strFilter = "(objectcategory=computer);"
strAttrs = "cn,operatingSystem," & _
"operatingSystemVersion,operatingSystemServicePack,description,whenCreated;"
strScope = "subtree"
Set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADsDSOObject"
objConn.Open "Active Directory Provider"
Set objRS = objConn.Execute(strADsPath & strFilter & strAttrs & strScope)
objRS.MoveFirst
While Not objRS.EOF
objExcel.ActiveCell.Value = objRS.Fields(0).Value
objExcel.ActiveCell.Offset(0,1).Value = objRS.Fields(1).Value
objExcel.ActiveCell.Offset(0,2).Value = objRS.Fields(2).Value
objExcel.ActiveCell.Offset(0,3).Value = objRS.Fields(3).Value
objExcel.ActiveCell.Offset(0,4).Value = objRS.Fields(4).Value
objExcel.ActiveCell.Offset(0,5).Value = objRS.Fields(5).Value
objExcel.ActiveCell.Offset(1,0).Activate
objRS.MoveNext
Wend
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dave Wade
Sent: Monday, September 18, 2006 6:04 AM
To: [email protected]
Subject: [ActiveDir] Ad Reporting Tools
Folks,
I am struggling with a fairly simple request. We would like a simple
report that lists how many PC's there are in each OU into an Excel
Spreadsheet. Well I have managed to do this with CSVDE and the summary
report in Excel. Is there a better (low cost) solution?
Dave Wade
E-Services
0161 474 5456
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. As a public body, the Council may be required to disclose
this email, or any response to it, under the Freedom of Information Act
2000, unless the information in it is covered by one of the exemptions
in the Act.
If you receive this email in error please notify Stockport e-Services
via [EMAIL PROTECTED] and then permanently remove it from
your system.
Thank you.
http://www.stockport.gov.uk
**********************************************************************
________________________________________________________________
Sent via the WebMail system at mail.activedir.org
List info : http://www.activedir.org/List.aspx
List FAQ : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.activedir.org/ml/threads.aspx