locked
Managementscope per region RRS feed

  • Question

  • We have different support teams according to country or region. As we are migrating to Exchange Online, i want to create a management scope per country. Instead of creating each managementscope individual, i wanted to script the creation of these managements scopes.

    $reg = Get-Recipient -ResultSize unlimited | Select -ExpandProperty CountryOrRegion -Unique

    i ran a test to see if the concept was good, however it wasn't

    $reg | % {write-host "$($_); "New-ManagementScope -Name $_ -RecipientRestrictionFilter {CountryOrRegion -eq $_} -WhatIf}

    I can clearly see that S_ has the good value, however that value is not excepted in the RecipientRestrictionFilter.

    When i run it to see the actual result, i can see that the RecipientResctrictionFilter is set to "CountryOrRegion -ne $null", instead of "CountryOrRegion -eq "Morroco".

     What am i doing wrong?


    Answers provided are coming from personal experience, and come with no warranty of success. I as everybody else do make mistakes.


    • Edited by Killerbe Thursday, June 25, 2020 10:53 AM
    Monday, June 22, 2020 1:29 PM

Answers

  • Hi,

    I try to assign a value of CountryOrRegion to $reg directly, use New-ManagementScope cmdlet to create the scope for one specific CountryOrRegion. I get the same result:

    $reg = "France" New-ManagementScope -Name $reg -RecipientRestrictionFilter {CountryOrRegion -eq $reg}


    It seems that we cannot set the variable with comparison operator. We have to set the RecipientRestrictionFilter for the management scope manually, instead of using variable with comparison operator to meet the requirement.

    Additionally, the first command you provided can help you list all values for CountryOrRegion:

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Tuesday, June 23, 2020 5:03 AM

All replies

  • Hi,

    I try to assign a value of CountryOrRegion to $reg directly, use New-ManagementScope cmdlet to create the scope for one specific CountryOrRegion. I get the same result:

    $reg = "France" New-ManagementScope -Name $reg -RecipientRestrictionFilter {CountryOrRegion -eq $reg}


    It seems that we cannot set the variable with comparison operator. We have to set the RecipientRestrictionFilter for the management scope manually, instead of using variable with comparison operator to meet the requirement.

    Additionally, the first command you provided can help you list all values for CountryOrRegion:

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Tuesday, June 23, 2020 5:03 AM
  • Thanks for the research. It looks that I have my work cut out then, we have 101 countries within our organization.

    Answers provided are coming from personal experience, and come with no warranty of success. I as everybody else do make mistakes.

    Tuesday, June 23, 2020 9:16 AM