Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Password Expiration - Enable or Disable

01 Jan 2014   #10
Brink

64-bit Windows 10 Pro
 
 

It sounds like you may have made a mistake entering the command. Possible with the user name. Please go ahead and type net users in the elevated command prompt, press Enter, then do step 2 in OPTION TWO, and post back with a screenshot showing everything in the command prompt to see if anything may stand out.


My System SpecsSystem Spec
.
01 Jan 2014   #11
psychotron

Home 7 64 on Alienware and Asus. W8 on Lenovo.
 
 

Thanks Brink. Problem was I was using 'Swen' as that's what I named my user account. After doing the new users prompt I saw Owner-1 and gave that a try and it worked.

Screenshots included.


Attached Images
Password Expiration - Enable or Disable-2.png Password Expiration - Enable or Disable-3.png Password Expiration - Enable or Disable-4.png Password Expiration - Enable or Disable-5.png 
My System SpecsSystem Spec
01 Jan 2014   #12
Brink

64-bit Windows 10 Pro
 
 

You're most welcome.

Yep, that was the issue with no "Swen". Did you by chance rename "Owner-1" to have a display name of "Swen" instead?
My System SpecsSystem Spec
13 Apr 2015   #13
dkotula

Windows 7 Pro
 
 

Can this be done at the group level? I would like for the administrator accounts to remain, but would like the group "Users" to expire. I am deploying local password policies and this is the only thing I have left to configure and deploy.

I have tried something like wmic group where name='Users' set PasswordExpires=True, but doesn't work.
Please enlighten me great one.
Thanks
Dave
My System SpecsSystem Spec
.

13 Apr 2015   #14
dkotula

Windows 7 Pro
 
 

I have a script written by someone else that creates local user accounts, can something be added to make all new users have Set PasswordExpire=True. Sorry, I'm a little rusty in my coding these days.

Code:
$strComputer=$env:computername
#Input file required C:\utils\users.txt
ForEach ($user in (Import-CSV "C:\utils\CreateLocalAccounts\qtpusers.txt")){
  write-host $user.username
  write-host $user.password

#get-content "C:\utils\CreateLocalAccounts\qtpusers.txt" | ForEach-Object {
#Create the user account and assign a default password
$objOU = [adsi]"WinNT://."
$objUser = $objOU.Create("User", $user.username)
$objuser.setPassword($user.password)
$objuser.setinfo()
#Enable [User must change password at next logon]
#$objuser.PasswordExpired = 0
$objuser.PasswordLastSet = 0
$objuser.SetInfo()
#Add the User account to the local Administrators Group
$computer = [ADSI]("WinNT://" + $strComputer + ",computer") 
$group = $computer.psbase.children.find("Users")  
$group.Add("WinNT://" + $strComputer + "/" + $user.UserName)  

}
My System SpecsSystem Spec
15 Apr 2015   #15
dkotula

Windows 7 Pro
 
 

Can a powershell wild card be used in Name=, for all users?
wmic path win32_useraccount where name='.*?' set passwordexpires=true
My System SpecsSystem Spec
16 Apr 2015   #16
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Quote   Quote: Originally Posted by dkotula View Post
I have a script written by someone else that creates local user accounts, can something be added to make all new users have Set PasswordExpire=True. Sorry, I'm a little rusty in my coding these days.
Try tacking
Code:
wmic path Win32_UserAccount where Name="$user.username" set PasswordExpires=true
under the line
Code:
$group.Add("WinNT://" + $strComputer + "/" + $user.UserName)

Quote   Quote: Originally Posted by dkotula View Post
Can a powershell wild card be used in Name=, for all users?
wmic path win32_useraccount where name='.*?' set passwordexpires=true
You can use wildcards in WMIC but it works a little differently from PowerShell. To use wildcards in WMIC specify the "Like" operator instead of "=". Also, your wildcard symbols must abide to the WMI Query Language where percent symbols (%) represent any character and amount of characters, and an underscore (_) represents any single character.
Code:
wmic path Win32_UserAccount where "Name Like '%'" set PasswordExpires=true
But you don't even need wildcards for the task: wmic path Win32_UserAccount alone will list all users. So to set PasswordExpires=True for all user accounts, just run
Code:
wmic path Win32_UserAccount set PasswordExpires=True
My System SpecsSystem Spec
16 Apr 2015   #17
dkotula

Windows 7 Pro
 
 

Works like a charm, thank you.
Do you know off hand what is used for "User must change password at next logon"?
My System SpecsSystem Spec
16 Apr 2015   #18
Brink

64-bit Windows 10 Pro
 
 

Quote   Quote: Originally Posted by dkotula View Post
Works like a charm, thank you.
Do you know off hand what is used for "User must change password at next logon"?
It's to force the user to do just that when their password expires.
My System SpecsSystem Spec
16 Apr 2015   #19
dkotula

Windows 7 Pro
 
 

Sorry, I should have specified more, I was wondering about the command to enable that feature.
It doesn't seem to be listed as an option in win32_userAccount Set, does the command reside somewhere else?
My System SpecsSystem Spec
Reply

 Password Expiration - Enable or Disable




Thread Tools




Similar help and support threads
Thread Forum
Password Expiration - Change MAX and MIN Password Age
How to Change Maximum and Minimum Password Age in Windows 7 and Windows 8 This will show you how to change the maximum and minimum password age in days the password for all users can be used before it expires and must be changed by the user in Windows 7 and Windows 8. By default it is 42...
Tutorials
I need to disable password expiration on Windows 7 Home Edition
I bought laptop (Toshiba) in Spring 2012. Computer ran just fine until Oct/Nov 2013 when the FBI impersonator malware got on it. I have never had a password on this laptop. I had to take it to a computer tech. He did something to get it up and running again. After he did whatever he did, I...
System Security
Screen Saver Password Protection -Enable or Disable
How to Enable or Disable Screen Saver Password Protection in Windows 7 and Windows 8 This tutorial will show you how to enable or disable password protection to display the logon screen on resuming from the screen saver in Windows 7 and Windows 8. Through Screen Saver Settings for...
Tutorials
Password Expiration Issue
(Connected via domain) On login I need a way for users to see that there password is about to expire in a more (In your face way!):eek: I.E compared to the default set up that windows 7 provides, which is the balloon popup that disappears after 5 seconds... This is not really useful as it is mostly...
General Discussion
Password History Enforcement - Enable or Disable
How to Enable or Disable Password History Enforcement in Windows 7 and Windows 8 Password history determines the number of unique new passwords that have to be associated with and used by a user before an old password can be reused again. This enables administrators to enhance security by...
Tutorials
build 7100 disable expiration
Is there anything out yet for disabling the expiration on the 7100 build? Starting June 1st it will be turning off every 2 hours.
Performance & Maintenance


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 04:22.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App