zhouqi0921 发表于 2010-5-5 17:44:31

计算机退域脚本

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]
查看完整版本: 计算机退域脚本

请大家牢记南瓜园网址 www.nan2008.com