Chris- The script below will pull the computers from the specified OU and dump the computer name and path. If you want all of the computers in your domain, edit the strLDAPPath line so that it's just strLDAPPath = objDSE.Get("defaultNamingContext"). That cuts out having to first generate the list of computers in the domain and then feed it to the script.
Note that if you have a large number of computers in your domain, you'll need to increase objCommand.Properties("Size Limit") ======================================================================== ========= Const ForReading = 1, ForWriting = 2, ForAppending = 8 wscript.echo "The script has started" 'Create the output file set fileSys = CreateObject("Scripting.FileSystemObject") Set fileTxt = fileSys.OpenTextFile("machinePath.txt", ForWriting, True) fileTxt.Writeline("Computer Name" & vbTab & "DN") Set objDSE = GetObject("LDAP://rootDSE") strLDAPPath = "ou=workstations,ou=itsd,ou=doa," & objDSE.Get("defaultNamingContext") Set objCommand = CreateObject("ADODB.Command") Set objConnection = CreateObject("ADODB.Connection") objConnection.Provider = "ADSDSOObject" objConnection.Open "Active Directory Provider" objCommand.ActiveConnection = objConnection strBase = "<LDAP://" & strLDAPPath & ">" strFilter = "(&(objectClass=user)(objectCategory=computer))" strAttributes = "name,ADsPath" strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree" objCommand.CommandText = strQuery objCommand.Properties("Page Size") = 100 objCommand.Properties("Timeout") = 30 objCommand.Properties("Cache Results") = False objCommand.Properties("Size Limit") = 1000 Set adoRecordset = objCommand.Execute While NOT adoRecordset.EOF fileTxt.WriteLine(adoRecordset.Fields.Item("name") & vbTab & adoRecordset.Fields.Item("ADSPath")) adoRecordset.MoveNext Wend wscript.echo "End of Script" ======================================================================== ======================== -----Original Message----- From: Stauffer, Christopher [mailto:[EMAIL PROTECTED] Sent: Friday, October 22, 2004 6:20 AM To: [EMAIL PROTECTED] Subject: RE: [ActiveDir] New to AD enter a computer name and have it dump the path That way I could just feed it all of the domain computers and have it resolve the OU. The way I have it now you can only run one OU at a time. It would be great to automate it even further. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Coleman, Hunter Sent: Thursday, October 21, 2004 9:31 PM To: [EMAIL PROTECTED] Subject: RE: [ActiveDir] New to AD Did you want to enter a computer name and have it dump the path, or have the script dump the path for all computers in a given OU? -----Original Message----- From: Stauffer, Christopher [mailto:[EMAIL PROTECTED] Sent: Thursday, October 21, 2004 5:56 PM To: [EMAIL PROTECTED] Subject: RE: [ActiveDir] New to AD Just rename .zip Directions are inside Does anybody have a script that will display a computers full OU path? Like this Cn=computername,OU=blabla,DC=com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rodney Gardiner Sent: Thursday, October 21, 2004 7:37 PM To: [EMAIL PROTECTED] Subject: RE: [ActiveDir] New to AD A copy of the script could come in handy if you are willing to send me a copy. Thanks _____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stauffer, Christopher Sent: Friday, 22 October 2004 7:50 AM To: [EMAIL PROTECTED] Subject: RE: [ActiveDir] New to AD Just wanted to thank everybody who added there two cents. I have a working script that does exactly what my boss wanted. It could be a little better but I'm not a coder. If anybody wants a copy let me know. _____ From: Stauffer, Christopher Sent: Thursday, October 21, 2004 9:02 AM To: '[EMAIL PROTECTED]' Subject: New to AD I'm new to AD. Our network is Finally migrating to Active Directory 2000. (yeah I know 2003 is better but is isn't our call) anyway during the migration when joining new Windows XP or Windows 2000 computers to the Windows 2000 domain, the computer name appears in Active Directory but the computer description that is on the computer does not show up in AD. Why does this happen? In network places I can see the computer description, but in AD it is just blank unless I manually add it. Is there a way to pull the computer description from the local box into AD when the computer joins the domain I was told this by guys on another news group Its two separate fields. When you give a description to a computer object in AD users and computers, you are applying the description to the object, and not the computer itself. When you logon to a workstation and add a description to it, you are adding the description to the machine itself, and not the object in AD. That is why you see the different behaviors. Unfortunately the 2 fields aren't tied together. As for how to fix it, I think if a script ran that read the description from the local machine, and then connected to AD to update the computer object with the same name, you would be good to go. So i guess my question is does anybody have a script that can do this. Thanks, CHRIS STAUFFER <>< Distributive Systems Specialist II Bureau of Information Technology ' : 1(717)783-9049 ext 244 / : [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> List info : http://www.activedir.org/mail_list.htm List FAQ : http://www.activedir.org/list_faq.htm List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ List info : http://www.activedir.org/mail_list.htm List FAQ : http://www.activedir.org/list_faq.htm List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ List info : http://www.activedir.org/mail_list.htm List FAQ : http://www.activedir.org/list_faq.htm List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/