Quantcast
Channel: Microsoft forum - dslreports.com
Viewing all articles
Browse latest Browse all 8524

Powershell - Need Advice

$
0
0
I am just starting to learn about PowerShell and can already see how useful it will be. I am trying to create a small script that will search AD for accounts expiring within a specific time frame, then output the Display name, account expiration date and email address to csv. The problem I am running into with this simple script is that I can't figure out how to get it to poll the AD attribute for email address and add it to the csv. When I add EmailAddress to Select-Object it just returns "Microsoft.ActiveDirectory.Management.ADPropertyValueCollection" If anyone has any suggestions, or alternative ways to do this, I would appreciate the input. ..Import-Module ActiveDirectory Search-ADAccount -AccountExpiring -TimeSpan "120" | Select-Object Name,AccountExpirationDate | Sort-Object AccountExpirationDate | Export-Csv Expiring-Accounts.csv

Viewing all articles
Browse latest Browse all 8524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>