Skip navigation

Q. How can I use a script to determine a client computer's local site?

A. To return the current site of a computer, you can use the ADSystemInfo object to call the GetDCSiteName function, as the following code shows:

Dim sys
Set sys = CreateObject("ADSystemInfo")
wscript.echo "Domain Controller site: " & sys.GetDCSiteName(".")
which you can see running as follows:
D:\temp>cscript getsite.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Domain Controller site: Smallville
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.