2015年10月27日 星期二

新增 win7 使用者以及修改電腦名稱 並且設定新user自動登入

轉自 http://boywhy.blogspot.tw/2015/06/vbscript-win7-user.html

Dim user Dim strCommand Dim myKey Dim pasword dim ComputerName user=InputBox("Please Enter User : ","GFI user Setting") pasword=InputBox("Please Enter Password : ","GFI user Setting") 'change computername Set objShell = WScript.CreateObject("Wscript.Shell") Set objNetwork = WScript.CreateObject("WScript.Network") ComputerName = objNetwork.ComputerName strCommand= "wmic computersystem where caption='" & ComputerName &"' rename " & user objShell.Run strCommand 'add user strCommand= "net user " & user &" " & pasword & " /ADD" objShell.Run strCommand Wscript.Sleep 500 'add to Administrators Group strCommand ="net localgroup administrators " & user &" /add" objShell.Run strCommand Wscript.Sleep 500 'kill default user strCommand ="net user user /DELETE" objShell.Run strCommand Wscript.Sleep 500 'modify autologin =1 objShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon","1","REG_SZ" objShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", user, "REG_SZ" objShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword", pasword, "REG_SZ" 'reboot strCommand ="shutdown.exe /R /T 5 /C ""Rebooting your computer now!"" " objShell.Run strCommand Wscript.Echo strCommand

沒有留言:

張貼留言