Re: automate the properties TCP/IP
Here's a script i use. It does dns, ip, subnet, wins, etc. There might be
some extra code in here that doesn't need to be here, but it all works.
--START--
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("172.20.12.1")
strSubnetMask = Array("255.255.0.0")
strGateway = Array("172.20.0.1")
strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
Else
End If
Next
arrNewDNSServerSearchOrder = Array("10.0.0.6", "10.0.0.22", "10.0.0.23")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfigs
If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
For Each strDNSServer In objNicConfig.DNSServerSearchOrder
Next
End If
intSetDNSServers = _
objNicConfig.SetDNSServerSearchOrder(arrNewDNSServ erSearchOrder)
If intSetDNSServers = 0 Then
Else
WScript.Echo " Unable to replace DNS server search order list."
End If
Next
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfigs
If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
For Each strDNSServer In objNicConfig.DNSServerSearchOrder
Next
End If
Next
strWINSPrimaryServer = "10.0.0.6"
strWINSSecondaryServer = "10.0.0.22"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfigs
intSetWINSServer = objNicConfig.SetWINSServer(strWINSPrimaryServer, _
strWINSSecondaryServer)
If intSetWINSServer = 0 Then
ElseIf intSetWINSServer = 1 Then
Else
End If
Next
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfigs
Next
WScript.Echo "The IP address and all that bacon has been changed!."
--END--
"gustavo" <gustavo@discussions.microsoft.com> wrote in message
news:7DC8575A-8B3E-4DA3-8418-C4138ED48F6B@microsoft.com...
> It is possible to create a script to automate the properties TCP/IP on
> multiple clients, where this script takes to which properties TCP/IP that
> her
> belong(concern).
>
> Thank you for your since they are too many equipments
|