案例分析:
IP池不够,不会自动release.
用户特别急的时候我们只能手动分配一个IP给它,
但是用户并没有控制面板的权限,而且什么图标都没有。(Block by group policy)
要Local IT 登陆自己的账号才可以
写了如下VBS,不用登陆自己账号也可以修改。记得要用管理员去跑
脚本环境Win10 pro 英文版
请修改不要直接食用。
StrIP = inputbox("Please input IP,Sample:10.86.88.X")strMask = "255.255.255.0"
strGW = "10.86.88.1"
strDNS1 = "10.62.193.31"
strDNS2 = "10.62.193.32" strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array(strIP)
strSubnetMask = Array(strMask)
strGateway = Array(strGW)
strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapterserrEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)arrDNSServers = Array(strDNS1,strDNS2)errDNS = objNetAdapter.SetDNSServerSearchOrder(arrDNSServers)
If errEnable = 0 Then
WScript.Echo "Should be done...."
Else
WScript.Echo "Should be done,Be Happy"
End If
Next