常用脚本

 修改计算机名称

sNewName=InputBox("请输入您的姓名全拼并确保与RTX帐号一致如您是“刘德华”,则请输入 liudehua,如有问题请联系星火IT部。","重装完毕按提示操作以便您的计算机能正常联网!")

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

 

 


'将计算机加入域
'***********************
'* [url=http://support.microsoft.com/kb/222525]http://support.microsoft.com/kb/222525[/url]
'* [url=http://54master.com/bbs/archiver/tid-82205.html]http://54master.com/bbs/archiver/tid-82205.html[/url]
'* Start Script
'***********************
Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4
Const WIN9X_UPGRADE = 16
Const DOMAIN_JOIN_IF_JOINED = 32
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144
strDomain = "abc.cn"
'domain需更改为自己域的名称
strPassword = "zxcvbnm"
'有domain admins组权限的用户及密码
strUser = "inad"
Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName
Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
strComputer & "'")
ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, strDomain & "\" & strUser, NULL, _
JOIN_DOMAIN + ACCT_CREATE)
Msgbox ""& vbcr &"再次登陆时请勿必使用您刚输入的姓名全拼登陆如 liudehua,初始密码为空,并点击“选项”按钮选择 登陆到 SPAEKE"

 

 

 

 

 

 

'将域用户加入本地管理员组

Dim oWshNetwork
Set oWshNetwork = WScript.CreateObject("WScript.Network")
Dim sLogonComputerName,sLogonUserName
'得到当前登录计算机名
sLogonComputerName = Lcase(oWshNetwork.ComputerName)
sLogonUserName=oWshNetwork.UserName
'WScript.Echo sLogonComputerName
Dim oLocalGroup
'得到本地 administrators Group 对象
Set oLocalGroup = GetObject("WinNT://" + sLogonComputerName + "/Administrators,Group")
'WScript.Echo oLocalGroup.Name

'注意下一句中的 HENU-SOFTLAB 它必须与域的NETBIOS名大小写相一致,否则会出错
If oLocalGroup.IsMember("WinNT://SPARKE/"+sLogonComputerName) Then
WScript.Quit
Else
oLocalGroup.Add "WinNT://SPARKE/"+sLogonComputerName
End If

 


'重启计算机

Set sh=WScript.CreateObject("WScript.Shell") 
sh.Run "Shutdown -r -t 0"


'*****************
'* End Script
'*****************

你可能感兴趣的:(vbs)