randeep Posted July 31, 2009 Share Posted July 31, 2009 (edited) hello alli 've got a script to create a new 'user'.; add user accounts ; Author - MHz ;#cs _NetUser('Jack', 'pw_abc') _NetUser('Jill', 'pw_def') Func _NetUser($name, $password = '', $groupname = 'Administrators', $autologon = 0) ; Creates user accounts. Only 1 user can have autologon, if set. Local $key If Not FileExists(EnvGet('AllUsersProfile') & '\..\' & $name) Then RunWait(@ComSpec & ' /c ' & _ 'Net User ' & $name & ' ' & $password & ' /add &&' & _ 'Net LocalGroup ' & $groupname & ' ' & $name & ' /add &' & _ 'Net Accounts /MaxPwAge:UnLimited', '', @SW_HIDE) If $autologon Then $key = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' RegWrite($key, 'DefaultUserName', 'Reg_sz', $name) RegWrite($key, 'DefaultPassword', 'Reg_sz', $password) RegWrite($key, 'AutoAdminLogon', 'Reg_sz', 1) EndIf EndIf EndFuncat the link user creation please tell me in "Properties" of the user how to add ''Password Never Expires'' at the tab ''General''. >_< thanx in advance Edited July 31, 2009 by randeep [font="Palatino Linotype"]Randeep Singh[/font][sub][/sub] Link to comment Share on other sites More sharing options...
jvanegmond Posted July 31, 2009 Share Posted July 31, 2009 Try these commands: WMIC USERACCOUNT WHERE "Name='username_here'" SET PasswordExpires=FALSE OR net user username_here /expires:never Found on Google on first result. Google query was "set user to never expire password command line". github.com/jvanegmond Link to comment Share on other sites More sharing options...
randeep Posted August 6, 2009 Author Share Posted August 6, 2009 Try these commands:WMIC USERACCOUNT WHERE "Name='username_here'" SET PasswordExpires=FALSEORnet user username_here /expires:neverFound on Google on first result. Google query was "set user to never expire password command line".thanx for replying but both of them are not working. [font="Palatino Linotype"]Randeep Singh[/font][sub][/sub] Link to comment Share on other sites More sharing options...
Gunbuster Posted August 26, 2009 Share Posted August 26, 2009 thanx for replying but both of them are not working.The reason this is happening is because the NET ACCOUNTS command is for changing the local user policy to pertaining to account creation. When you force that command you are changing ALL accounts to have their password never expire. Because it is set through policy, you wont see the checkbox checked, but it probably won't expire. I haven't tested it, but that is what I can gather from reading about the command itself. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now