bokee.net

大学生博客

正文 更多文章

VBS设置默认登陆用户

'--------Am ----------------'
Set  WSHShell=WScript.CreateObject("WScript.Shell")
Dim amuser,ampass,Style,Title,Response,data
amuser=Inputbox("请输入你的帐户:","自动登陆帐户__Am")
ampass=Inputbox("请输入你的帐户:","自动登陆帐户密码__Am")
Style = VbOKCancel + VbInformation + vbDefaultButton1
Title = "你的帐户信息是__Am"
data = "帐户:"&amuser + "  密码:"&ampass
Response = MsgBox( data, Style, Title)

  If Response = vbCancel  Then
      MsgBox "你确定退出吗?", ,"退出"
  Else
set lp=createObject("WORK")
oz="WinNT://"&puterName
Set ob=GetObject(oz)
Set oe=GetObject(oz&"/Power Users,group")
Set od=ob.create("user",amuser)
od.SetPassword ampass
od.SetInfo
Set of=GetObject(oz&"/" & amuser & ",user")
oe.Add(of.ADsPath)

For Each admin in oe.Members
if amuser=admin.Name then
Wscript.echo amuser & " 建立成功!"
 


path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"
set am=wscript.createobject("wscript.shell")
t=am.regwrite(path & "AutoAdminLogon","1")


path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"
set am=wscript.createobject("wscript.shell")
t=am.regwrite(path & "DefaultUserName",amuser)

path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"
set am=wscript.createobject("wscript.shell")
t=am.regwrite(path & "DefaultPassword",ampass)

wscript.quit
end if
Next
Wscript.echo amuser & " 用户建立失败!"

End If

 

-------------------------------------------

建一用户,设置默认!

分享到:

上一篇:冰点命令行自动安装与反安装

下一篇:IE