Compare Get-ReceiveConnector Permissions Groups against variable

HI, Exchange Permissions Groups set on a HT table are stored within a Noteproperty. To extract this data requires a hash table.

How can I compare each HT connectors Exchange groups, against a predefined value, to see it correlates as expected?

$Hash = @{}
$exsrv = $env:computername
Get-ReceiveConnector -Server $exsrv | Select-Object name, permis* | % {$Hash [$_.Name] = $_.PermissionGroups}
$Hash

Open in new window

LVL 6
patelbg2001Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SubsunCommented:
against a predefined value
What you have to compare against? is it a csv file with connector and permission details?

If yes.. check if the file is in the format of the result file of following command..
Get-ReceiveConnector -Server ServerName | Select-Object name, permis* | export-csv c:\temp\report.csv -nti

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
patelbg2001Author Commented:
no, I don't want it to go to a text file, say for example $g = " ExchangeServers",

foreach ($connector)
if ($connector.value -ne $g) {
........
}

Open in new window

0
SubsunCommented:
If $g contains only single value..
$Hash = @{}
$exsrv = $env:computername
Get-ReceiveConnector -Server $exsrv | Select-Object name, permis* | % {$Hash [$_.Name] = $_.PermissionGroups}

$g = "ExchangeServers"

ForEach ($connector in $Hash.Keys){

  if ($connector -ne $g)  {

  #Do something

  }

}

Open in new window


If $g is a array (more than one values)..
$g = "ExchangeServers","ExchangeServers1","ExchangeServers2"

ForEach ($connector in $Hash.Keys){

  if ($g -notcontains $connector)  {

  #Do something

  }

}

Open in new window

0
patelbg2001Author Commented:
I've requested that this question be deleted for the following reason:

Not valid question
0
SubsunCommented:
@patelbg2001, The Answer provided should work. I don't understand what you mean by 'Not valid question'. Could you please clarify?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.