Jump to content

Enable Admin Account and set "User cannot change password"


Recommended Posts

So far, I have this script AUTOIT

; ENABLE ADMIN ACCOUNT$strComputer = @ComputerName$user = @UserNameLocal $colUsers, $sTmp, $Array[1] = ["user"]$colUsers = ObjGet("WinNT://" & @ComputerName)If IsObj($colUsers) Then    $colUsers.Filter = $Array    For $objUser In $colUsers        if $objUser.Name = "Administrator" Then            ;Account disabled?            If $objUser.AccountDisabled Then                $objUser.AccountDisabled = False            EndIf            $objUser.SetPassword("PASSWORD")            $objUser.setInfo        EndIf    NextEndIf

It works for how it is setup (thank you to whomever created it, I can't take credit.). It enables and sets the password. However, I want to be able to check the attribute found in the properties so that Users cannot change the password for it.

 

post-393927-0-65880400-1402509213.jpg

Edited by CNewell
Link to comment
Share on other sites


I primarily run all my wmic commands in a .cmd. You can try this, I didn't test it out, just edited for syntax highlighting.

RunWait (@ComSpec & " /c wmic useraccount where " & Chr(34) & "name='username'" & Chr(34) & " set passwordchangeable=false")
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...