Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Little help for a novice - Need a ps script to list user with their email only.

$
0
0

Hi,

I need to extract every month the user list which have their email information on it, so i don't need to extract the user services etc from the AD.

Today, i'm using this script i made :

clear-host
Import-Module activedirectory
$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToString('dd-MM-yyyy')
Get-ADUser -Filter * -server ad.test -SearchBase "dc=ad,dc=test" -Properties DisplayName,sn,givenname,Company,Description,EmailAddress | select DisplayName,sn,givenname,Company,Description,EmailAddress | export-clixml "C:\users_$CurrentDate.xml"

But like this i have every user of the ad even the ones without email.

Is there any filter to only extract theses one ?

Thanks for your help.



Viewing all articles
Browse latest Browse all 15028

Trending Articles



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