Sponsor

2006/04/24

Listing all DCs for an AD Domain

Subscribe to Windows IT Pro: http://list.windowsitpro.com/t?ctl=27E10:610453

Make sure your copy of Windows Tips & Tricks UPDATE isn't mistakenly blocked by antispam software! Be sure to add Windows_TipsandTricks_UPDATE@list.windowsitpro.com to your list of allowed senders and contacts.

====================

This email newsletter comes to you free and is supported by the following advertisers, which offer products and services in which you might be interested. Please take a moment to visit these advertisers' Web sites and show your support for Windows Tips & Tricks UPDATE.

Argent Software http://list.windowsitpro.com/t?ctl=27E18:610453

CrossTec http://list.windowsitpro.com/t?ctl=27E07:610453

====================

==== Sponsor: Argent Software ====

NETWORK TESTING LABS COMPARES ARGENT TO MOM 2005 Network Testing Labs, one of the world's leading independent research companies, concluded that "Argent's suite had a smaller footprint, was more scalable, supported more platforms, had a more responsive and intuitive user interface and gave us more useful reports," the report says. "Argent's suite of monitoring products emerged from our testing with flying colors."

Download this FREE Comparison Paper now: http://list.windowsitpro.com/t?ctl=27E18:610453

====================

FAQs Q. How can I list all domain controllers (DCs) for an Active Directory (AD) domain? Q. What is a good, free virtual CD/DVD drive package? Q. How can I use a script to determine the site name of a domain controller (DC)? Q. How can I verify whether a domain controller (DC) is in a certain site? Q. What tools are available to help me check the health of my ISA Server 2004 installation?

==== Sponsor: CrossTec ====

Try it Free: Access & Control PCs from your USB NetOp Remote Control provides the most complete, scalable, and secure remote control software available. Access & support PCs & servers behind your corporate firewall from your desktop, CE device or launch it on your USB drive! Now, with the NEW NetOp On Demand option, users outside your environment can request help and be assisted via a tiny, temporary, download - no installation or firewall configuration and NO per session or recurring charges. Trust NetOp security including 256- bit encryption, centralized audit logs, and NetOp's unique Security & Gateway server modules. Free support & evaluation. http://list.windowsitpro.com/t?ctl=27E07:610453

====================

==== FAQs ==== by John Savill, FAQ Editor, jsavill@windowsitpro.com

Q. How can I list all domain controllers (DCs) for an Active Directory (AD) domain?

A. The following script, which you can download at http://list.windowsitpro.com/t?ctl=27E15:610453 , accepts a domain as its parameter, then lists all DCs in that domain. Some lines wrap because of space constraints.

Const ADS_SCOPE_SUBTREE = 2 If Wscript.Arguments.Count < 1 Then Wscript.Echo "Arguments <domain name> required. For example:" & vbCrLf _ & "cscript listdcs.vbs dc=savilltech,dc=com" Wscript.Quit(0) End If

strDomainName = Wscript.Arguments(0)

Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCOmmand.ActiveConnection = objConnection objCommand.CommandText = _ "Select distinguishedName from " & _ "'LDAP://cn=Configuration," & strDomainName & "' " _ & "where objectClass='nTDSDSA'" objCommand.Properties("Page Size") = 1000 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF DCDN = objRecordSet.Fields("distinguishedName").Value DomainController = Mid(DCDN,21,InStr(Mid(DCDN,21),",")-1) Wscript.Echo "Domain Controller: " & DomainController objRecordSet.MoveNext Loop

This sample execution produced the following output when I ran it on my system:

D:\Temp>cscript listdcs.vbs dc=savilltech,dc=com

Domain Controller: SAVDALDC01 Domain Controller: SAVDALDC02 Domain Controller: SAVLONDC01 Domain Controller: SAVDALLABDC01

-------------------- Q. What is a good, free virtual CD/DVD drive package?

A. SlySoft's Virtual CloneDrive is a very good and intuitive virtual CD/DVD solution that you can download at http://list.windowsitpro.com/t?ctl=27E19:610453 . It lets you mount CD/DVD images (e.g., ISO files) by double-clicking the image file or via a context menu on the virtual drive, as the figure at http://list.windowsitpro.com/t?ctl=27E0F:610453 shows.

-------------------- Q. How can I use a script to determine the site name of a domain controller (DC)?

A. The following script, which you can download at http://list.windowsitpro.com/t?ctl=27E14:610453 , takes as its parameter the name of a domain controller (DC) and returns its site name.

If Wscript.Arguments.Count < 1 Then Wscript.Echo "Arguments <domain controller name> required. For example:" & vbCrLf _ & "cscript checkdcsite.vbs savdaldc01" Wscript.Quit(0) End If strDcName = Wscript.Arguments(0) Set objADSysInfo = CreateObject("ADSystemInfo") strDcSiteName = objADSysInfo.GetDCSiteName(strDcName) WScript.Echo "DC Site Name: " & strDcSiteName

--------------------

Q. How can I verify whether a domain controller (DC) is in a certain site?

A. The following script, which you can download at http://list.windowsitpro.com/t?ctl=27E17:610453 , determines whether a DC is in the site in question. You must input the name of the DC and the site whose membership you're checking. If the DC is in the site, the script returns TRUE with an error level of 0; otherwise, it returns FALSE and an error level of 1.

if Wscript.Arguments.Count < 2 Then Wscript.Echo "Arguments <domain controller name> <site name> " & _ "required. For example:" & vbCrLf _ & "cscript checkdcsite.vbs savdaldc01 dallas" Wscript.Quit(0) End If strDcName = Wscript.Arguments(0) strSiteName = Wscript.Arguments(1) Set objADSysInfo = CreateObject("ADSystemInfo") strDcSiteName = objADSysInfo.GetDCSiteName(strDcName) if UCase(strDcSiteName) <> UCase(strSiteName) then Wscript.Echo "FALSE" Wscript.Quit(1) else Wscript.Echo "TRUE" end if

Here's a sample execution and output of the script:

D:\Temp>cscript checkdcinsite.vbs savdaldc01 london FALSE D:\Temp>echo %errorlevel% 1 D:\Temp>cscript checkdcinsite.vbs savdaldc01 dallas TRUE D:\Temp>echo %errorlevel% 0 --------------------

Q. What tools are available to help me check the health of my ISA Server 2004 installation?

A. Microsoft has released the Internet Security and Acceleration (ISA) Server 2004 Best Practices Analyzer Tool, which you can download at http://list.windowsitpro.com/t?ctl=27E06:610453 . You can run the tool to perform a full check of the ISA Server installation and make recommendations about steps to take. After you run a "Start a new Best Practices scan," you can view a report of the problems that need to be resolved, as the figure at http://list.windowsitpro.com/t?ctl=27E16:610453 shows. When you select any of the problems areas, the tool presents information about how to resolve the problem.

--------------------

==== Hot Release ====

Discover how to ensure efficient ongoing management of your digital certificates, how your business will benefit by addressing unique online security issues and more! http://list.windowsitpro.com/t?ctl=27E0E:610453

==== Events and Resources ==== ( A complete Web and live events directory brought to you by Windows IT Pro: http://list.windowsitpro.com/t?ctl=27E1A:610453 )

Make sure that your DR systems are up to the challenge of a real natural disaster by learning from messaging survivors of Hurricanes Katrina and Rita. Live Event: Tuesday, May 2 http://list.windowsitpro.com/t?ctl=27E0A:610453

How do you ensure that your email system isn't vulnerable to a messaging meltdown? In this Web seminar, Exchange guru Paul Robichaux tells you what you should do before you have an outage to increase your chances of coming out of it smelling like roses. http://list.windowsitpro.com/t?ctl=27E0D:610453

Learn the best ways to manage your email security (and fight spam) using a variety of solutions and tips. http://list.windowsitpro.com/t?ctl=27E0B:610453

Expert Ben Smith describes the benefits of using server virtualization to make computers more efficient. Download this exclusive podcast today! http://list.windowsitpro.com/t?ctl=27E0C:610453

Ensure that you're being effective with your internal network security. Are your DIY options protecting you against worms, BotNets, Trojans, and hackers? Make sure! Live Event: Tuesday, May 23 http://list.windowsitpro.com/t?ctl=27E09:610453

==== Featured White Papers ====

Examine the risks of allowing unwanted or offensive content into your network and learn about the technologies and methodologies to defend against inappropriate content, spyware, IM, and P2P. http://list.windowsitpro.com/t?ctl=27E2C:610453"

==== Announcements ==== (from Windows IT Pro and its partners)

Exclusive Spring Savings Subscribe to Windows IT Pro and SAVE 58%! Along with your 12 issues, you'll get FREE access to the entire Windows IT Pro online article archive, which houses more than 9,000 helpful articles. This is a limited-time offer, so order now: http://list.windowsitpro.com/t?ctl=27E13:610453

Save 44% off Windows Scripting Solutions For a limited time, order the Windows Scripting Solutions newsletter and SAVE up to $80. You'll get 12 helpful issues loaded with expert- reviewed downloadable code and scripting techniques, as well as hundreds of tips on automating repetitive tasks. You'll also get FREE, unlimited access to the full online scripting article library (more than 500 articles). Subscribe now: http://list.windowsitpro.com/t?ctl=27E11:610453

====================

==== Contact Us ====

About the newsletter -- letters@windowsitpro.com About technical questions -- http://list.windowsitpro.com/t?ctl=27E1B:610453 About product news -- products@windowsitpro.com About your subscription -- tipsandtricks@windowsitpro.com About sponsoring UPDATE-- salesopps@windowsitpro.com

====================

This email newsletter is brought to you by Windows IT Pro, the leading publication for IT professionals deploying Windows and related technologies. Subscribe today. http://list.windowsitpro.com/t?ctl=27E12:610453

Manage Your Account You are subscribed as news-and-stuff@arconati.us

You are receiving this email message because you subscribed to this newsletter on our Web site. To unsubscribe, click the unsubscribe link:

http://list.windowsitpro.com/u?id=28351AE7DCFB1F6CD89D8E1AFC11BA43

View the Windows IT Pro Privacy policy at http://www.windowsitpro.com/AboutUs/Index.cfm?action=privacy

Windows IT Pro, a division of Penton Media, Inc. 221 East 29th Street, Loveland, CO 80538, Attention: Customer Service Department

Copyright 2006, Penton Media, Inc. All Rights Reserved.

No comments:

Post a Comment

Keep a civil tongue.

Label Cloud

Technology (1464) News (793) Military (646) Microsoft (542) Business (487) Software (394) Developer (382) Music (360) Books (357) Audio (316) Government (308) Security (300) Love (262) Apple (242) Storage (236) Dungeons and Dragons (228) Funny (209) Google (194) Cooking (187) Yahoo (186) Mobile (179) Adobe (177) Wishlist (159) AMD (155) Education (151) Drugs (145) Astrology (139) Local (137) Art (134) Investing (127) Shopping (124) Hardware (120) Movies (119) Sports (109) Neatorama (94) Blogger (93) Christian (67) Mozilla (61) Dictionary (59) Science (59) Entertainment (50) Jewelry (50) Pharmacy (50) Weather (48) Video Games (44) Television (36) VoIP (25) meta (23) Holidays (14)

Popular Posts