/build/static/layout/Breadcrumb_cap_w.png

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)


5 Comments   [ + ] Show comments
  • Do you need help, or is this a working example?

    If it works, you should post it as a blog: http://www.itninja.com/blog/post/new - jknox 11 years ago
  • need help... this is not getting implemented..... - Itiwari 11 years ago
  • what OS your workstations are running? - SnowLyric 11 years ago
  • What type of errors, if any, are you receiving? - gcarpenter 11 years ago
  • It seems to work just fine for me...aside from that is has no steps for disabling the pre-existing local admin account. - Chris.Thomson@Sitel.Com 10 years ago

Answers (0)

Be the first to answer this question

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ