MSFN Forum: <SOLVED>Sysprep Change password on first boot - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

<SOLVED>Sysprep Change password on first boot

#1 User is offline   mchipser 

  • Junior
  • Pip
  • Group: Members
  • Posts: 61
  • Joined: 19-February 08

Posted 02 August 2011 - 12:04 PM

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

This post has been edited by mchipser: 03 August 2011 - 01:02 PM



#2 User is offline   IcemanND 

  • MSFN Junkie
  • Group: Super Moderator
  • Posts: 3,266
  • Joined: 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 02 August 2011 - 11:09 PM

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 User is offline   mchipser 

  • Junior
  • Pip
  • Group: Members
  • Posts: 61
  • Joined: 19-February 08

Posted 03 August 2011 - 12:08 PM

View PostIcemanND, on 02 August 2011 - 11:09 PM, said:

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

This post has been edited by mchipser: 03 August 2011 - 01:00 PM


#4 User is offline   tikal01 

  • Group: Members
  • Posts: 4
  • Joined: 19-August 11
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 19 August 2011 - 01:37 AM

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 User is offline   mandrake 

  • Newbie
  • Group: Members
  • Posts: 10
  • Joined: 02-March 12
  • OS:none specified
  • Country: Country Flag

Posted 08 March 2012 - 09:54 AM

Awsome, it works perfectly!

View Postmchipser, on 03 August 2011 - 12:08 PM, said:

View PostIcemanND, on 02 August 2011 - 11:09 PM, said:

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


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy