Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

[Powershell] Administrator Account Expiry Script


Recommended Posts

Posted

Hey all,

 

I was wondering if anyone has or could make and post a Powershell script here to set the Administrator Accounts Password Expiry on Windows Server 2008 R2 to Never Expire. If someone could post one that I could use and or adapt it would be brilliant.

 

Thanks

Posted (edited)

If you don't have that many admin accounts on AD, you can list them in a text file and do the below

 

Powershell to set AD user password to never Expire - Powershell.com

 

So, to prevent a user's password from expiring using the Quest AD cmdlets, use the following:

[color=#666666][font=Arial]Set-QADUser -Identity  -PasswordNeverExpires $true[/font][/color]
[color=#666666][font=Arial]or[/font][/color]
[color=#666666][font=Arial]Get-QADUser -Identity  | Set-QADUser -passwordNeverExpires $true
[/font][/color]

Maybe edit the 2nd line of code to :

[color=#666666][font=Arial] get-content “c:\users.txt” [/font][/color][color=#666666][font=Arial]| Set-QADUser -passwordNeverExpires $true
[/font][/color]

Edited by mac_shinobi
  • Thanks 1

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



×
×
  • Create New...