Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

<SOLVED>Sysprep Change password on first boot


  • Please log in to reply
4 replies to this topic

#1
mchipser

mchipser

    Junior

  • Members
  • Pip
  • 69 posts
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, 03 August 2011 - 01:02 PM.



How to remove advertisement from MSFN

#2
IcemanND

IcemanND

    MSFN Junkie

  • Super Moderator
  • 3,266 posts
  • OS:Windows 7 x64
  • Country: Country Flag
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()
}


#3
mchipser

mchipser

    Junior

  • Members
  • Pip
  • 69 posts

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, 03 August 2011 - 01:00 PM.


#4
tikal01

tikal01
  • Members
  • 4 posts
  • OS:Windows 2000 Professional
  • Country: Country Flag
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.

#5
mandrake

mandrake

    Newbie

  • Members
  • 10 posts
  • OS:none specified
  • Country: Country Flag
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 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN