Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

AD Accounts Disabled/Enabled Query

$
0
0

Hi powershell.com,

I'm trying to create a list of users with their account expiration date and the status of the account (either Disabled OR Enabled) but I'm missing a necessary filter.

Scouring the web, I've found how to return one or the other, but not both - and most search results regarding PS return password-related results, which are irrelevant for this query.

To clarify, I'd like a list of all AD user objects, their account expiration date, and their account status (either disabled or enabled - listed next to the user account name in the csv output).  I've gotten everything except the account disabled/enabled field using the following:

Get-ADUser -Filter * -Properties AccountExpirationDate | Select Name,SamAccountName,AccountExpirationDate | export-csv -NoTypeInformation "c:\ADusers.csv" 

 

 


Viewing all articles
Browse latest Browse all 6937

Latest Images

Trending Articles



Latest Images