Exchange on-prem decomm sript - Add-PermissionForEMT.ps1 parameter question

Copper Contributor

I want to decomm the last Exchange Server we have on prem, my only hang up at the moment is that the script you run (Add-PermissionForEMT.ps1) only has syntax for specifying *ONE* OU to set ACLs on Exchange objects.  

Our AD team doesn't want to alter the ACLs on all OUs, but we have multiple OUs at the root level that have Exchange objects in them... so I need to specify multiple OUs and containers.  Does anyone know the syntax for multiple OUs?   here's the example in the script itself...


# Usage: Add-PermissionForEMT.ps1 -RecipientOUs 'CN=OU1,DC=contoso,DC=com'


possibly this?




My main concern about running the script is that it runs the first part and then craps out when it goes to set the ACLs on these OUs.  Don't really want to run it multiple times...

1 Reply



How about this?


$OUs = "OU=ou1,DC=contoso,DC=com", "OU=ou2,DC=contoso,DC=com" $OUs | ForEach-Object { New-GPLink -Name "MyGPO" -Target $_ }