Howdy all, reviving this chain for a moment... Someone contacted me on this via email when I came back from DEC so I whipped up the joeware tool to do the address to subnet/site name mapping... You can find it on the joeware site with all of the other free tools on the Free Win32 C++ Tools page. It is called.... ATSN (Address To Subnet/Site Name).
Looks sort of like this... [Sat 03/27/2004 13:49:54.87] F:\DEV\cpp\ATSN>atsn 192.168.1.1 192.168.2.1 192.168.0.2 ATSN V01.00.00cpp Joe Richards ([EMAIL PROTECTED]) March 2004 IP Count: 3 >192.168.0.2;Default-First-Site-Name;192.168.0.2/32 >192.168.1.1;Default-First-Site-Name;(null) >192.168.2.1;Default-First-Site-Name;(null) The command completed successfully. [Sat 03/27/2004 13:50:23.79] F:\DEV\cpp\ATSN> Will also take input from a file and output to a file. You can also specify a DC to use for the resolution instead of letting the machine find the default LDAP (AD) server. ------------- http://www.joeware.net (download joeware) http://www.cafeshops.com/joewarenet (wear joeware) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of joe Sent: Sunday, February 22, 2004 3:42 PM To: [EMAIL PROTECTED] Subject: RE: [ActiveDir] OU/Computer accounts reorganization Assuming you have A. All of your subnets for these machines properly defined to subnets B. Proper DNS entries for all of these machines C. An easy way to map site to OU I would do the following 1. Generate in memory table of all machine names, machine's ou, current site, dns host name via AD query. 2. Loop through all machines 3. Retrieve the IP address from the dnshostname (nslookup or ip lookup in perl) 4. Do something that calls DsAddressToSiteNames to get the site name for that IP address 5. Check ou name / site name map for the machine's OU name to verify in the right OU 6. If different, move to new OU defined by the OU Name / Site Name map 7. End Loop All of that is readily available except to my knowledge something that lets you do the DsAddressToSiteNames. If you want to go down this road and can't find something that does that (or someone on the list isn't aware of something) send a note to joe at joeware.net and ask for it (this goes for anyone) and there is a programmer guy over there (or at least he likes to pretend to be one sometimes) who could whip up a little tool that takes an IP address and kicks out a site. Note that I have seen a couple of scripts that try to "fake" finding the site for an IP address. I haven't seen one that worked right yet. The method used has to be a btree to find the best match and all of the ones I have seen are doing simple string matching and if you had a hierarchical subnet to site layout it could fail to properly give you a site. Ex: You define some top level subnets and some lower level subnets but for only some of them... Ex: 136.0.0.0/8 - Site MainSite 136.124.234.0/24 - Site WAN Site 1 136.124.192.0/24 - Site WAN Site 2 Then if you send in 136.220.198.24 it returns nothing matching or returns MainSite for everything including 136.124.234.45. joe -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J0mb Sent: Friday, February 20, 2004 9:25 AM To: [EMAIL PROTECTED] Subject: [ActiveDir] OU/Computer accounts reorganization Good morning, We work in a native windows 2000 AD Architecture, with a single domain and 4 sites. Computer accounts have been organized into OUs according to which site they belong to. Unfortunately the reorganization wasn't performed well. We have cases of machines that were placed in the wrong Ous with subsequent problems with group policies which, in many cases, are linked to the Organizational units. There are Thousands of Pc accounts, unfortunately machine names do not help to determine their site. Anybody might want to suggest the best strategy to reorganize the PC accounts (maybe a script, or a commercial tool)? Thanks 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/