Quantcast
Channel: Exchange Server 2013 - Setup, Deployment, Updates, and Migration 论坛
Viewing all articles
Browse latest Browse all 7008

Settin a variable using Get-Mailuser. Need to exclude accounts with a warning.

$
0
0

Working on a project where we needed to automated the mail-enabling of mailusers.  I also need to create a csv file after the fact that kicks out those new mail enabled objects with their LegacyExchangeDN value.

So I setup this query to get all the valid mailusers that need to be mailenabled.  Valid meaning they have the targetaddress attribute set.  Need to be mail enabled because they do not have a legacyexchangedn value.

This works except for one issue.  Some of the accounts have a leading or trailing whitespace in their display name.  That is being addressed.  But in the meantime I need to put some code together that detects the error state and doesn't include those users in the $users variable.  So I can later use that variable to create the csv file.  Thoughts?

$users = Get-mailuser -ResultSize unlimited -OrganizationalUnit "domain.COM/Accounts/Users" `

-Filter {ExternalEmailAddress -ne $null} | ?{$_.legacyexchangeDN -eq ""}




Jeff C


Viewing all articles
Browse latest Browse all 7008

Trending Articles



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