Title: How to determine which is the default site

The default first site is usually one of the first objects created after the sites container itself. The USNCreated attribute should be pretty small. For Windows 2000 it should be less than 3500. For a fresh Windows 2003 AD, it should be less than 4200.

 

I had pretty good luck with the following query in the config container:

 

(&(objectclass=site)(USNCreated<=3500)) for our production Windows forest which started out life as Windows 2000.

 

((&(objectclass=site)(USNCreated<=4200))

 

Wook

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Coleman, Hunter
Sent: Wednesday, April 13, 2005 7:45 AM
To: [email protected]
Subject: RE: [ActiveDir] How to determine which is the default site

 

Not elegant, but fairly quick: take Robbie's script (http://www.rallenhome.com/books/adcookbook/src/11.02-list_sites.vbs.txt), add in objSite.WhenCreated to the output list, and write it out to a file. Then sort by date...

 

 

' This VBScript code lists all of the site objects.

 

' ---------------------------------------------------------------
' >From the book "Active Directory Cookbook" by Robbie Allen
' Publisher: O'Reilly and Associates
' ISBN: 0-596-00466-4
' Book web site: http://rallenhome.com/books/adcookbook/code.html
' ---------------------------------------------------------------

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("SiteDates.txt", ForWriting, True)

set objRootDSE = GetObject("LDAP://RootDSE")
set objSitesCont = GetObject("
LDAP://cn=sites," & _
                             objRootDSE.Get("configurationNamingContext") )
objSitesCont.Filter = Array("site")
for each objSite in objSitesCont
   fileTxt.WriteLine(objSite.Get("cn") & VBTab & objSite.WhenCreated)
next

wscript.echo "Script finished"

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ruston, Neil
Sent: Wednesday, April 13, 2005 7:54 AM
To: '[email protected]'
Subject: [ActiveDir] How to determine which is the default site

At some point in the dim, dark past, the default site was renamed (I assume it was not removed!)

Does anyone have a quick and easy way to determine which of the existing sites was once the default site? [It has been suggested that I look at the create date for all the sites and that the oldest one will be the default site :) I have >100 sites so need something more elegant/quicker. ]

Any suggestions more than welcome.

Thanks,
neil

==============================================================================
This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure.
==============================================================================

Reply via email to