Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change DNS Setting programically
#5
Maybe some lines in the VBScript code are empty. Then the multiline string ends. Must be space.

Macro Macro650
Code:
Copy      Help
lpstr code=
;On Error Resume Next
;
;strComputer = "."
;Set objWMIService = GetObject("winmgmts:" _
;;;;;& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
;
;Set colNetCards = objWMIService.ExecQuery _
;;;;;("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
;
;For Each objNetCard in colNetCards
;;;;;arrDNSServers = Array("156.154.70.22", "156.154.71.22")
;;;;;objNetCard.SetDNSServerSearchOrder(arrDNSServers)
;Next
VbsExec code


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)