在一些大规模进行域部署时,都会遇到如何快速的将用户计算机加入到域中。
以下为一个可以现实将计算机自动加入域的.vbs脚本。
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 = "bjstone.com" -------您的域名
strPassword = "123.com" --------加入域的域管理员密码
strUser = "administrator" ---------加入域的域管理员账号
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)
wscript.echo "The command completed successfully."
wscript.echo "Pls. Reset Your Computer!"
红色字内容不参与真正使用此脚本。
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://hqyman.cn/post/2962.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
休息一下~~