Browsed by
Tag: Active Directory

PowerShell: Changing Account Expiration Dates

PowerShell: Changing Account Expiration Dates

Sometimes we need to change a large number of expiration dates and doing it by hand can be quite a task, here I have two examples on how to do this. Both required Quest Active Roles Management Shell for Active Directory. Example 1 – If all the account have an attribute such as the description that is the same, it can be done this way, but it MUST be the same and match exactly: Get-QADUser -ou “ou=users,dc=site,dc=local” -includedproperties description,AccountExpires,SamAccountName -sAMAccountName…

Read More Read More

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