南瓜园

 找回密码
 注册
查看: 1570|回复: 0

计算机退域脚本

[复制链接]
发表于 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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

QQ|小黑屋|手机版|Archiver|南瓜园

GMT+8, 2024-11-18 16:40 , Processed in 0.084306 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表