用户加入域的脚本

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      = "XXX"            注:这里添的是域名,可谓netbios或者域名
strPassword = "XXX"             注:这里添的是具有加入域权限的帐户的密码
strUser        = "XXX"              注:这里添的是具有加入域权限的帐户
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 "计算机加入域完成!按确定后重新启动电脑!"
set    ws=wscript.createobject("wscript.shell")   
   ws.run    "shutdown    -r -t 0",0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值