Skip to content

Instantly share code, notes, and snippets.

@tostka
Created March 30, 2018 00:59
Show Gist options
  • Save tostka/9813a267723c4f83fbe80d1735ac68fb to your computer and use it in GitHub Desktop.
Save tostka/9813a267723c4f83fbe80d1735ac68fb to your computer and use it in GitHub Desktop.
$whatif=$true ;
$spltMbxGrant=@{
Identity="TARGETMAILBOX" ;
User="GRANTEE" ;
AccessRights="FullAccess";
whatif=$($whatif);
};
write-verbose "Running whatif test of add-MailboxPermission with following parameters" ;
$spltMbxGrant.whatif=$true ;
$spltMbxGrant | out-string ;
add-exomailboxpermission @Grantsplat ;
write-verbose "EXECUTING CHANGE:" ;
if(!$whatif){$spltMbxGrant.whatif=$false} ;
add-exomailboxpermission @Grantsplat ;
write-verbose "Updated Permissions:" ;
Get-exoMailboxPermission -Identity $spltMbxGrant.Identity |?{$_.User -match '^DOMAIN\\.*'} | select User,AccessRights,IsInherited,Deny | out-string| format-table -wrap ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment