Browsed by
Category: Tutorials

Tutorials I have written up, or mashed up from other sources.

PowerShell: Find User Accounts Expiring in 7 days

PowerShell: Find User Accounts Expiring in 7 days

This may help some of you; it looks for accounts within a certain OU and outputs their expiration date and email if their account expires in 7 days (no more, no less!). # Inspired by: http://gallery.technet.microsoft.com/scriptcenter/Email-Active-Directory-452a5640 # Modified for use by; Salomon Johns # Find users within a certain OU that have accounts expiring in 7 days (no more, no less) # Print out the results Get-QADUser -ou “ou=users,dc=test,dc=domain,dc=local” -includedproperties AccountExpires -sAMAccountName ‘*’ | ForEach-Object { $sevendays = (Get-Date).AddDays(7).ToString(‘yyyyMMdd’) $samaccountname…

Read More Read More