Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this possible?

Status
Not open for further replies.

SjrH

IS-IT--Management
Jun 24, 2003
747
GB
I need to create a script that is able to -

1. Scan an entire IP scope (x.x.x.1 - 254)
2. If any device responds on that scope, use Win32_NetworkAdapterConfiguration to return DHCPEnabled status, DHCP server address & DNS server search order.
3. IF DHCPEnabled = FALSE then modify the DNS server search order to given addresses.

I've been using scriptomatic to get the DHCPEnabled status, but i've several scopes to check and it will take forever to enter each ip address into the array, is there a faster way to generate the array? Also, I notice I get a lot of duplicate entries for a system, even when I add WHERE IPEnabled=TRUE into select.

TIA
 
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
For i = 2 To 253
If PingTest("172.22.3." & i, objWMI) = True
'bind to the remote WMI hive if you ahve permissions
Set objWMIRemote = GetObject("winmgmts:\\" & "172.22.3." & i & "\root\cimv2")
'chuck in your DHCP code making use of the objWMIRemote
Set objWMIRemote = Nothing
End If
Next



Function PingTest(strIP, objWMI)
'use WMI ping function to return result, putcode in here
PingTest = True
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top