计算机退域脚本
Const NETSETUP_ACCT_DELETE = 2 'Disables computer account in domain.strPassword = "password"
strUser = "kenmyer"
Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName
Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'")
strDomain = objComputer.Domain
intReturn = objComputer.UnjoinDomainOrWorkgroup _
(strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE)
wscript.echo "计算机已成功退出当前域!按确定后重新启动电脑!"
set ws=wscript.createobject("wscript.shell")
ws.run "shutdown -r -t 0",0
页:
[1]