If you prepare the latest version of the WinPE CD with the Add-ons (inc.
WSH, ADSI and WMI), then you have the Win32_NetworkConfigurationSetting
class.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of joe
Sent: Monday, February 06, 2006 5:36 PM
To: [email protected]
Subject: RE: [ActiveDir] Script to determine a machine's site

Does PE have ipconfig? If not can you copy it over? 


--
O'Reilly Active Directory Third Edition -
http://www.joeware.net/win/ad3e.htm 
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, February 06, 2006 9:48 AM
To: [email protected]
Subject: RE: [ActiveDir] Script to determine a machine's site

Thanks for the feedback, Deji, Guido, joe et al.

The one piece of code I'm missing now is one that can determine a machine's
IP address. Any suggestions how that may be done (again, assume the machine
is not joined to a domain and is running PE).

I can then feed that address into the logic that I do have (similar to that
outlined below).


neil


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: 03 February 2006 23:21
To: [email protected]
Subject: RE: [ActiveDir] Script to determine a machine's site

I don't have the script I wrote for this handy, but the logic I used is
this:
 
Get host's IP Address
Split it into whatever subnet mask use in your subnet/site configurations.
Do a Case....Case Else looking for a match.
If you get a match, that computer is in that site.
 
e.g. 
IP is 192.168.100.201
Subnet Mask is /16
192.168.100 = SiteA
192.168.101 = SiteB
192.168.102 = SiteC
192.168.103 = SiteC
 
So, you go
Select Case IPAddy
 Case "192.168.100" : strSiteName = "SiteA"
 Case "192.168.101" : strSiteName = "SiteB"
 Case "192.168.102", "192.168.103" : strSiteName = "SiteC"
.....
 
Works in PE
 
HTH
 
Sincerely,

Dèjì Akómöláfé, MCSE+M MCSA+M MCT
Microsoft MVP - Directory Services
www.readymaids.com - we know IT
www.akomolafe.com
Do you now realize that Today is the Tomorrow you were worried about
Yesterday?  -anon

________________________________

From: [EMAIL PROTECTED] on behalf of joe
Sent: Fri 2/3/2006 2:53 PM
To: [email protected]
Subject: RE: [ActiveDir] Script to determine a machine's site


Actually DsAddressToSiteNames will only take socket addresses
(PSOCKET_ADDRESS, type AF_INET) to translate, the parameter that takes the
dnshostname is the one to specify what DC you want to resolve the addresses
to subnet/sites on. 
 
Actually the previously mentioned ATSN[1] utiltity is a light wrapper over
this call.
 
  joe
 
 
 
 
[1]  Note the initials - I am not great with tool names. The best tool name
I have isn't even a name I thought up and I haven't made the tool yet. I
just know what I want it to do and what its name will be.
 
--
O'Reilly Active Directory Third Edition -
http://www.joeware.net/win/ad3e.htm

 
________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Greene, Adam S
Sent: Friday, February 03, 2006 3:54 PM
To: [email protected]
Subject: RE: [ActiveDir] Script to determine a machine's site


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: [email protected]
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. 
List info   : http://www.activedir.org/List.aspx
List FAQ    : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/



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.

List info   : http://www.activedir.org/List.aspx
List FAQ    : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

List info   : http://www.activedir.org/List.aspx
List FAQ    : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

List info   : http://www.activedir.org/List.aspx
List FAQ    : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to