From 0827f8e7383a8509bb2fb63dfe81e02ce965ea6b Mon Sep 17 00:00:00 2001 From: Dennis Trinks Date: Mon, 7 May 2012 21:34:39 +0200 Subject: [PATCH] added vbs --- CLIENT_DATA/set_2nd_ip.vbs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 CLIENT_DATA/set_2nd_ip.vbs diff --git a/CLIENT_DATA/set_2nd_ip.vbs b/CLIENT_DATA/set_2nd_ip.vbs new file mode 100644 index 0000000..04f6765 --- /dev/null +++ b/CLIENT_DATA/set_2nd_ip.vbs @@ -0,0 +1,22 @@ +On Error Resume Next +Const HKEY_LOCAL_MACHINE = &H80000002 + +IParrData = Array("0.0.0.0", Wscript.Arguments(0)) +SubnetarrData = Array("0.0.0.0", Wscript.Arguments(1)) +strKeyPath = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces" + +strComputer = "." + +Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _ +& strComputer & "\root\default:StdRegProv") + +Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") +Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter where NetConnectionStatus = 2 AND Name <> 'TAP-Win32 Adapter V9'",,48) +For Each objItem in colItems + Set colItems2 = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where index = "&objItem.index,,48) + For Each objItem2 in colItems2 + strKeyPath = strKeyPath &"\"& objItem2.SettingID + objWMI.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,"IPAddress",IParrData + objWMI.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,"SubnetMask",SubnetarrData + next +Next \ No newline at end of file