nickster Posted April 21, 2010 Posted April 21, 2010 Hello,would someone be able to tell me if it is possible to use the Autounattend file to set Windows to NOT expire a password for an account which is created in the autounattend file please?I did use the search function but could not find anything relevant.Thank you.
MrJinje Posted April 21, 2010 Posted April 21, 2010 Here is a little powershell snippet I am using.... $EXPIRY = gwmi win32_USERACCOUNT | Where-Object {$_.NAME -eq "MrJinje"};$EXPIRY.PasswordExpires = $False;$EXPIRY.Put()But I guess you want to use your autounattend.xml, so instead you should probably run this command during first login.wmic useraccount where "name='MrJinje'" set PasswordExpires=FALSEBoth scripts do the same thing, doesn't matter which you use.
nickster Posted April 21, 2010 Author Posted April 21, 2010 Here is a little powershell snippet I am using.... $EXPIRY = gwmi win32_USERACCOUNT | Where-Object {$_.NAME -eq "MrJinje"};$EXPIRY.PasswordExpires = $False;$EXPIRY.Put()But I guess you want to use your autounattend.xml, so instead you should probably run this command during first login.wmic useraccount where "name='MrJinje'" set PasswordExpires=FALSEBoth scripts do the same thing, doesn't matter which you use.Thanks very much for replying MrJinje...I found the wmic command on Experts Exchange soon after I posted my question. I made a batch file which I ran from SetupComplete.cmd and tested on a virtual machine and it works like a charm.Thanks again
maxXPsoft Posted April 21, 2010 Posted April 21, 2010 then make it simpler from setupcomplete.cmd no scriptscmd /C start /wait NET ACCOUNTS /MAXPWAGE:UNLIMITEDC:\Users\YOURNAME>NET ACCOUNTSForce user logoff how long after time expires?: NeverMinimum password age (days): 0Maximum password age (days): Unlimited
bobthenob Posted April 27, 2010 Posted April 27, 2010 hiif i used "wmic useraccount where "name='MrJinje'" set PasswordExpires=FALSE"where would i put it in my autonated xmlcheersand if ive already installedand want to stop the password expiringhow would i do that cheers
MrJinje Posted April 27, 2010 Posted April 27, 2010 (edited) If you pop over to Max's thread (see sticky) you will find some good examples.Place it in the oobesystem pass during the Microsoft-Windows-Shell-Setup component <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>making the magic happen</Description> <CommandLine>cmd /C wmic useraccount where "name='Bob'" set PasswordExpires=FALSE</CommandLine> </SynchronousCommand> </FirstLogonCommands> Edited April 27, 2010 by MrJinje
maxXPsoft Posted April 27, 2010 Posted April 27, 2010 If you pop over to Max's thread (see sticky) you will find some good examples.Place it in the oobesystem pass during the Microsoft-Windows-Shell-Setup component <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>making the magic happen</Description> <CommandLine>cmd /C wmic useraccount where "name='Bob'" set PasswordExpires=FALSE</CommandLine> </SynchronousCommand> </FirstLogonCommands>and probably best to use that to only get user intended from Firstlogon, my example above may get all users but not sure
crazydrve Posted July 21, 2011 Posted July 21, 2011 Hey all, need some help. I am trying to create a user but also have the "password never expires" box checked after a unattended install. It will work if i manually run the cmd file after install with the checkbox but if i run unattended with following setup it doesnt add the checkboxAny ideas would be helpfulAlso i was sure if to put this in the unattended area but saw password expiration titlecurrent folder structure:$OEM$/files inside = cmdlines.txt and useraccounts.cmdcmdlines.txt:[COMMANDS]"useraccounts.cmd"useraccounts.cmd:net user Admin /add /PASSWORDCHG:YES /expires:never /passwordreq:nonet localgroup Administrators Admin /addnet localgroup Users Admin /deleteWMIC USERACCOUNT WHERE "Name='Admin'" SET PasswordExpires=FALSEEXITThanks for any help or ideasBill
maxXPsoft Posted July 23, 2011 Posted July 23, 2011 why are you Admin /deleteAll that is needed is last line cmd /C wmic useraccount where "name='Bob'" set PasswordExpires=FALSE
crazydrve Posted July 24, 2011 Posted July 24, 2011 Thanks but it didnt work... I want admin delete to remove him from users group and only be in adminstrators groupI am probably doing this the wrong way but i need it to run as part of a unattended install. everything works except the checkbox not being added.thanks for the helpBill
maxXPsoft Posted July 25, 2011 Posted July 25, 2011 (edited) I don't know where to find "password never expires" box butIf I go to Admin prompt and type Net User memememeAccount active YesAccount expires NeverPassword last set 7/17/2011 5:05:52 AMPassword expires Never Edited July 25, 2011 by maxXPsoft
Tripredacus Posted July 25, 2011 Posted July 25, 2011 I don't know where to find "password never expires" boxIt is in the properties of the User Account in the Local Users and Groups CPL, on the General tab. On a Domain Controller, it is on the Account tab
crazydrve Posted July 25, 2011 Posted July 25, 2011 thanks guys but got it working....So now when I do a fresh unattended install, at the end of the install it will add a user, make changes and auto logon that user...I thinks it ugly but it worksfolder structure:$oem$---CMDLINES.TXT---useraccounts.CMD---autologon.reg------\$1---------\Install------------START.CMD cmdlines.txt[COMMANDS]"useraccounts.cmd" useraccounts.CMDnet user Admin /add /PASSWORDCHG:YESnet localgroup Administrators Admin /addnet localgroup Users Admin /deleteREGEDIT /S autologon.regEXIT autologon.regWindows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]"DefaultUserName"="Admin""DefaultPassword"="""AutoAdminLogon"="1" start.cmdCLS@echo offECHO.ECHO adding password never expires checkboxWMIC USERACCOUNT WHERE "Name='Admin'" SET PasswordExpires=FALSEECHO.ECHO Deleting Temp Installation Files...RD /S /Q %systemdrive%\installEXIT
maxXPsoft Posted July 25, 2011 Posted July 25, 2011 (edited) I had to boot into Ultimate cause don't have box on Premium. gonna anytime update here in a few daysI was able to do that with an Administrator command prompt. Then checked box and it was checkedC:\Windows\system32>wmic useraccount where "name='xxxxx'" set PasswordExpires=FALSEUpdating property(s) of '\\xxxxxxxx\ROOT\CIMV2:Win32_UserAccount.Domain="xxxxxx",Name="xxxxxx"'Property(s) update successful. Edited July 25, 2011 by maxXPsoft
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now