Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

<SOLVED>Sysprep Change password on first boot

Featured Replies

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


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

  • Author

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

  • 3 weeks later...

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.

  • 6 months later...

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

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.