Book now with code EOY2025
nster wrote: » Just to clarify, you want to export a list of people's e-mails for all users in a particular OU who have the passwordneverexpire property, and their e-mails are not necessarily username+domain, right?
Qord wrote: » In active directory, is the email property populated with the correct email address? Like, is that the email address you'd use to send the heads up email?
nster wrote: » Would something like this work? Get-ADUser -Filter 'PasswordNeverExpires -eq $true' -SearchBase "OU=AccUsers,OU=TestUsers,DC=LOL,DC=com" -Properties passwordneverexpires, emailaddress | Sort-Object Name | Select-Object Name, passwordneverexpires, emailaddress | Export-Csv -Path C:\Users\administrator\Desktop\test.csv I actually installed a VM for the first time on my PC and Server 2012 to try this out xD
markulous wrote: » Got it figured out. By going the opposite direction in the OU, that worked using: Search-ADAccount -Users Only -PasswordNeverExpires -SearchBase "ou=z,ou=y,ou=x,dc=ad,dc=blah,dc=com" | Get AD-User -Properties Mail | Select Mail | Export-CSV C:\users Also, Search-ADAccount won't find email addresses so I had to use Get AD-User for that and the former to search the Password Never Expires.
knownhero wrote: » Would you like the script to also email each user? I could get something basic put up for you if you want.
nster wrote: » easiest way is to go in the properties of the OU you want and see what is written under distinguishedName, often times it's CN vs OU thing
Use code EOY2025 to receive $250 off your 2025 certification boot camp!