Jump to content
Sign in to follow this  
BigDaddyO

Set Static IP does not work in French Canadian PC's

Recommended Posts

BigDaddyO

I have this script that will set static IP settings for a NIC which works fine. Except when running it on a French Canadian computer. It seems to go thorugh fine, i get no errors, but it does not set the Static information.

Does anyone have an idea what might be causing the problem?

$oWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$oNetAdapters = $oWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=True")
Dim $sIPAddress[1] = ["192.168.0.4"]
Dim $sSubnetMask[1] = ["255.255.255.0"]
Dim $sGateWay[1] = ["192.168.0.1"]
Dim $aDNS[2] = ["192.168.10.239", "192.168.10.239"]
For $objNetAdapters in $oNetAdapters
    $iSetStatic = $objNetAdapters.EnableStatic($sIPAddress, $sSubnetMask)
    $iSetGateway = $objNetAdapters.SetGateways($sGateWay)
    $iSetDNS = $objNetAdapters.SetDNSServerSearchOrder($aDNS)
    MsgBox(0, "", "Settings now set for NIC with MAC of:  " & $objNetAdapters.MACAddress & @CRLF & "SettingID" & $objNetAdapters.SettingID)
    RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\" & $objNetAdapters.SettingID & "\Connection", "ShowIcon", "REG_DWORD", 1)
    RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\" & $objNetAdapters.SettingID & "\Connection", "Name", "REG_SZ", "Test Name")
    ExitLoop
Next

Thanks,

Mike


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.