The function call DsAddressToSiteNames will take a
dnsHostName and give you the site it belongs to. If you cannot implement that
call, there are scripts out there that do a brute force query of AD for sites
and subnets to get you the site name. Search for the function call and
"DsAddressToSiteNames _vbscript_" to find them on google. With a lot of
sites and subnets, that approach could get unwieldy though. If you can call a
remote web service from your _vbscript_ or
write a win32 implementation of the call, that would be a better way to go.
There is code out there on doing a C# version.
-Adam
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Friday, February 03, 2006 7:52 AM
To: ActiveDir@mail.activedir.org
Subject: [ActiveDir] Script to determine a machine's site
Does anyone have a script which can:
- Interrogate the local machine for its IP
address and mask
- Determine the subnet
which the machine resides in
-
Determine the site that corresponds to the that subnet
And all this must be possible on a machine which is
not joined to a domain.
Ideally, the script
should work when WinPE is running, too, as the machine is being built.
Any ideas?
neil
PLEASE READ: The
information contained in this email is confidential and
intended for the
named recipient(s) only. If you are not an intended
recipient of this
email please notify the sender immediately and delete your
copy from your
system. You must not copy, distribute or take any further
action in reliance
on it. Email is not a secure method of communication and
Nomura International
plc ('NIplc') will not, to the extent permitted by law,
accept
responsibility or liability for (a) the accuracy or completeness of,
or (b) the presence
of any virus, worm or similar malicious or disabling
code in, this
message or any attachment(s) to it. If verification of this
email is sought then
please request a hard copy. Unless otherwise stated
this email: (1) is
not, and should not be treated or relied upon as,
investment research;
(2) contains views or opinions that are solely those of
the author and do
not necessarily represent those of NIplc; (3) is intended
for informational
purposes only and is not a recommendation, solicitation or
offer to buy or sell
securities or related financial instruments. NIplc
does not provide
investment services to private customers. Authorised and
regulated by the
Financial Services Authority. Registered in England
no. 1550505 VAT No.
447 2492 35. Registered Office: 1 St Martin's-le-Grand,
London, EC1A 4NP. A
member of the Nomura group of companies.