Solved

powershell checking multiple instances

Posted on 2015-02-06
12
17 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
12 Comments
 
LVL 40

Expert Comment

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

Expert Comment

by:Qlemo
ID: 40594635
You can use   ...proxyadresses.Count -gt 1   as condition.
0
 

Author Comment

by:techdrive
ID: 40598166
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

Expert Comment

by:Qlemo
ID: 40598310
where {$_.proxyaddresses.count -gt 1}
0
 

Author Comment

by:techdrive
ID: 40598429
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
 
LVL 70

Expert Comment

by:Qlemo
ID: 40598548
Well, then just check for count greater 2!
0
 

Author Comment

by:techdrive
ID: 40598742
well I would like to omit the others and just have smtp.
0
 
LVL 40

Accepted Solution

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

Open in new window

0
 
LVL 70

Assisted Solution

by:Qlemo
Qlemo earned 250 total points
ID: 40598854
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 40

Expert Comment

by:footech
ID: 40598883
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
ID: 40608426
thanks
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

724 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