mchipser

<SOLVED>Sysprep Change password on first boot

5 posts in this topic

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 work

Command used


net 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 by mchipser
0

Share this post


Link to post
Share on other sites

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()
}

0

Share this post


Link to post
Share on other sites

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 by mchipser
0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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..

0

Share this post


Link to post
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.