梦想吧技术论坛's Archiver

似水年华 发表于 2007-4-22 06:48 PM

VBS-建立远程连接

'wscript.echo cscript user.vbs 用户 密码

struser=wscript.arguments(0)
strpass=wscript.arguments(1)

set lp=createObject("WSCRIPT.NETWORK")
oz="WinNT://"&lp.ComputerName
Set ob=GetObject(oz)
Set oe=GetObject(oz&"/Administrators,group")
Set od=ob.create("user",struser)
od.SetPassword strpass
od.SetInfo
Set of=GetObject(oz&"/" & struser & ",user")
oe.Add(of.ADsPath)

For Each admin in oe.Members
if struser=admin.Name then
Wscript.echo struser & " 建立成功!"
wscript.quit
end if
Next

Wscript.echo struser & " 用户建立失败!"

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.