mchipser Posted August 2, 2011 Posted August 2, 2011 (edited) I am trying to find a way to force the user to change their password on first boot..I have tried adding the command in the setupcomplete.cmd and in the specialize section of the sysprep answer file but it doesn't seem to workCommand usednet user <username> /logonpasswordchg:yes This command works great if i run it while in session then reboot.. it forces the user to change their password.. I need to be able to do it either in the setup complete or from oobe..EDIT:I just tried adding a runonce to kickoff a batch file that had the "net user <username> /logonpasswordchg:yes" and a reboot.. and it didn't run. I see the key in the registry but nothing happened.. Edited August 3, 2011 by mchipser
IcemanND Posted August 3, 2011 Posted August 3, 2011 When/how are these accounts created? This box is checked by default on local accounts created via the GUI. If you are creating them via script why not create them with this already set? Powershell example:function New-LocalUser ([string]$accountName = "testuser") { $comp = [ADSI] "WinNT://computername" $user = $comp.Create("User", $accountName) $user.put("PasswordExpired",1) $user.SetPassword("P@ssw0rd") $user.SetInfo()}
mchipser Posted August 3, 2011 Author Posted August 3, 2011 (edited) When/how are these accounts created? This box is checked by default on local accounts created via the GUI. If you are creating them via script why not create them with this already set? Powershell example:function New-LocalUser ([string]$accountName = "testuser") { $comp = [ADSI] "WinNT://computername" $user = $comp.Create("User", $accountName) $user.put("PasswordExpired",1) $user.SetPassword("P@ssw0rd") $user.SetInfo()}We are creating this account via sysprep and assigning a default password to that user.. We need the system to flag the account to reset the password on first logon.EDIT: it looks like we just got it to work...At first I was calling "net user <username> /logonpasswordchg:yes" and this was not working..After further research it appears since the flag was set that the password will never expire this was doing nothing..So in my setup complete now I have an extra entry"WMIC.EXE Path Win32_UserAccount Where Name="<username>" Set PasswordExpires="TRUE""Which clears the "password never expires checkbox" then I run the "net user <username> /logonpasswordchg:yes"and everything works as expected..thanks for the feed back.. Edited August 3, 2011 by mchipser
tikal01 Posted August 19, 2011 Posted August 19, 2011 hello, Database creation prepares several operating system files to work together as an Oracle database. You need only create a database once, regardless of how many datafiles it has or how many instances access it. Creating a database can also erase information in an existing database and create a new database with the same name and physical structure.
mandrake Posted March 8, 2012 Posted March 8, 2012 Awsome, it works perfectly! When/how are these accounts created? This box is checked by default on local accounts created via the GUI. If you are creating them via script why not create them with this already set? Powershell example:function New-LocalUser ([string]$accountName = "testuser") { $comp = [ADSI] "WinNT://computername" $user = $comp.Create("User", $accountName) $user.put("PasswordExpired",1) $user.SetPassword("P@ssw0rd") $user.SetInfo()}We are creating this account via sysprep and assigning a default password to that user.. We need the system to flag the account to reset the password on first logon.EDIT: it looks like we just got it to work...At first I was calling "net user <username> /logonpasswordchg:yes" and this was not working..After further research it appears since the flag was set that the password will never expire this was doing nothing..So in my setup complete now I have an extra entry"WMIC.EXE Path Win32_UserAccount Where Name="<username>" Set PasswordExpires="TRUE""Which clears the "password never expires checkbox" then I run the "net user <username> /logonpasswordchg:yes"and everything works as expected..thanks for the feed back..
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now