char="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Redim num(25)
for x=0 to 25
num(x)=right(left(char, x+1), 1)
next
Randomize
for x=1 to 12
sNewName=sNewName & num(24*Rnd)
next
Set oShell = CreateObject ("WSCript.shell")
sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"
With oShell
.RegDelete sTcpipParamsRegPath & "Hostname"
.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With
Redim num(25)
for x=0 to 25
num(x)=right(left(char, x+1), 1)
next
Randomize
for x=1 to 12
sNewName=sNewName & num(24*Rnd)
next
Set oShell = CreateObject ("WSCript.shell")
sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"
With oShell
.RegDelete sTcpipParamsRegPath & "Hostname"
.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With
[本日志由 tiancao1001 于 2014-05-13 01:59 PM 编辑]
|
|
暂时没有评论
| 发表评论 - 不要忘了输入验证码哦! |
用户登陆
站点日历
站点统计
最新评论
VBS 修改注册表中计算机名 [ 日期:2014-05-13 ] [ 来自: