Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Change Windows DNS Settings

by tachyon (Chancellor)
on Mar 05, 2003 at 00:29 UTC ( [id://240494]=note: print w/replies, xml ) Need Help??


in reply to Change Windows DNS Settings

Here is some VBS that sets all the network settings except DNS - can't do all your work for you. I will leave it up to you to get the required object and property and turn this into Win32::OLE code if you really want. Here is a hint You DO KNOW that the logon script will run locally so if you want it to be in perl your target machines will need perl installed or you will need to make the script and exe....

strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cim +v2") Set colNetAdapters = objWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TR +UE") strIPAddress = Array("192.168.0.42") strSubnetMask = Array("255.255.255.0") strGateway = Array("192.168.0.1") strGatewayMetric = Array(1) For Each objNetAdapter in colNetAdapters errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask +) errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetr +ic) If errEnable = 0 Then WScript.Echo "The IP address has been changed." Else WScript.Echo "The IP address could not be changed." End If Next
cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://240494]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-18 15:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found