Need a VB Script to disable the Admin account and then create a new "localadmin" account. And the password for localadmin account would be "HostNameXXXX"
Set objShell = CreateObject("Wscript.Shell")
Set objEnv = objShell.Environment("Process")
strComputer = objEnv("COMPUTERNAME")
strUser = inputbox("Enter the username for the new admin account.")
strPass = inputbox("Enter the password for the new account.")
Set colAccounts = GetObject("WinNT://" & strComputer & ",computer")
Set objUser = colAccounts.Create("user", strUser)
objUser.SetPassword strPass
Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
objPasswordExpirationFlag = ADS_UF_DONT_EXPIRE_PASSWD
objUser.Put "userFlags", objPasswordExpirationFlag
objUser.SetInfo
Set Group = GetObject("WinNT://" & strComputer & "/Administrators,group")
Group.Add(objUser.ADspath)
Answers (0)
Be the first to answer this question
If it works, you should post it as a blog: http://www.itninja.com/blog/post/new - jknox 11 years ago