自动加入域脚本
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
请将以下内容存为VBS文件,在XP下运行即可实现加入域.
'***********************
'* [url=/kb/222525]/kb/222525[/url]
'* [url=/bbs/archiver/tid-82205.html]/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 = "yourdomainname"
'domain需更改为自己域的名称
strPassword = "youradminPASS"
'有domain admins组权限的用户及密码
strUser = "ADMINUSERNAME"
Set objNetwork = CreateObject("work")
strComputer = puterName
Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_='" & _
strComputer & "'")
ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, strDomain & "\" & strUser, NULL, _
JOIN_DOMAIN + ACCT_CREATE)
wscript.echo "The command completed successfully."
wscript.echo "Pls. Reset Your Computer!"
'*****************
'* End Script
'*****************