VBS改计算机名,加IP,网关,DNS,无需禁用网卡.重
(2010-05-03 09:46:40)
标签:
诛仙sf网
杂谈
请修改符合您自己的参数.
以下内容保存为 XXX.VBS
Dim Num
Num=Inputbox
("请输入机器号"+chr(10)&chr(13)+""+chr(10)&chr(13)+"取值范围2-254的数字")
dim Name
if Num<10 then
Name="BX00"
else
if Num<100 then
Name="BX0"
else
Name="BX"
end if
end if
Set Sh =
CreateObject("Wscript.Shell")
Sh.RegWrite
"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName",Name&Num,"REG_SZ"
Sh.RegWrite
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NV
Hostname",Name&Num,"REG_SZ"
Sh.RegWrite
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Hostname",哈都没了;,Name&Num,"REG_SZ"
Sh.RegWrite
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\VirtualNetworkNumber",Num,"REG_DWORD"
Sh.RegWrite ",8月8日………香烟;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters\VirtualNetworkNumber",Num,"REG_DWORD"
Set sh = Nothing
Set oShell = Nothing
strComputer = "."
Set objWMIService =
GetObject("winmgmts:\\"
& strComputer &
"\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration
where IPEnabled=TRUE")
strIPAddress =
Array("192.168.1."&Num+1)
strSubnetMask =
Array("255.255.255.0")
strGateway = Array(",诛仙sf网;192.168.1.1")
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress,
strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway)
Dim dns
dns=Array("61.187.98.6","61.187.98.3",面粉中掺漂
已成为潜规则;)
err=objNetAdapter.SetDNSServerSearchOrder(dns)
'msgbox(err)
Next
Set objWMIService =
GetObject("winmgmts:" _
&
"{impersonationLevel=impersonate}!\\"
& strComputer &
"\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
("Select * from
Win32_ComputerSystem")
For Each objComputer in colComputers
'ObjComputer.Rename("game"
&Num)
Next
Set objNetworkSettings =
objWMIService.Get("Win32_NetworkAdapterConfiguration")
objNetworkSettings.SetIPXVirtualNetworkNumber(Num)
分享:
喜欢
0
赠金笔
加载中,请稍候......
评论加载中,请稍候...
发评论
登录名: 密码: 找回密码 注册记住登录状态
昵 称:
评论并转载此博文
发评论
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。