Solved

powershell checking multiple instances

Posted on 2015-02-06
12
13 Views
Last Modified: 2016-06-24
I have a small issue. I am trying to figure out the best way to be able to tell all accounts with more than one smtp address and x400 addresses. I am using quest and notice the field s proxyaddresses. Any suggestions to be able to pull out all addresses with more than one smtp


proxyaddresses {smtp:user@again.com, smtp:john.doe@again.com}

or                       smtp:oneuseraddress@again.com, x400:c=us;a=;p=microsoft ; o=%; s=oneuseraddress@again.com, x400c=us;a:anotheraddress.com}
0
Comment
Question by:techdrive
  • 4
  • 4
  • 3
12 Comments
 
LVL 39

Expert Comment

by:footech
Comment Utility
So you want to return the users which have more than one value in proxyAddresses, and ignore all the others?
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
You can use   ...proxyadresses.Count -gt 1   as condition.
0
 

Author Comment

by:techdrive
Comment Utility
Footech yes I would like to only return the users who have more than one proxyaddresses and ignore the others. This is correct.

where {$_.proxyaddress.count -gt 1} <----is this correct Qlemo?
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
where {$_.proxyaddresses.count -gt 1}
0
 

Author Comment

by:techdrive
Comment Utility
I knew that was too easy. I am trying to get only if the SMTP has more than one. I am finding that all users have x400 and sips. I do not want to pull that info

 smtp:oneuseraddress@again.com, x400:c=us;a=;p=microsoft ; o=%; s=oneuseraddress@again.com, x400c=us;a:anotheraddress.com}
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
Well, then just check for count greater 2!
0
 

Author Comment

by:techdrive
Comment Utility
well I would like to omit the others and just have smtp.
0
 
LVL 39

Accepted Solution

by:
footech earned 250 total points
Comment Utility
You could use something like this.
Get-ADUser -filter * -Properties proxyaddresses | ? {($_.proxyaddresses -like "smtp:*").count -gt 3 }

Open in new window

0
 
LVL 68

Assisted Solution

by:Qlemo
Qlemo earned 250 total points
Comment Utility
Ok, if you cannot rely on always having SMTP and SIP, that makes sense.
I cannot test with Quest ATM, but with Exchange 2007, so you might have to adapt this a little:
? { ($_| Select -Expand ProxyAddresses | ? { $_.PrefixString -eq 'SMTP' }).Count -gt 1 } 

Open in new window

0
 
LVL 39

Expert Comment

by:footech
Comment Utility
Just noticed my number for the count was wrong (change the 3 to a 1 to fit your needs).  Blame it on my testing and pasting.
0
 

Author Comment

by:techdrive
Comment Utility
thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now