Currently we've been using below code to add SendAs/Full Access permissions on mailbox list stored in $MBXS ( input file taken from csv ), limitation is - we have to supply Trustee user by editing script each time ( e.g. –Trustee John@mydomain.com ) ... could someone please suggest a way that prompts us enter mailbox & user's UPN / Name on the go when script is executed with reference to below code ?
$MBXS = Get-Recipient -RecipientType UsermMilbox ForEach ($MBX in $MBXS) { Add-RecipientPermission $MBX.name -AccessRights SendAs –Trustee John@mydomain.com -Confirm:$False
Add-MailboxPermission $MBX.name -User John -AccessRights FullAccess -InheritanceType All -Confirm:$False
} Get-RecipientPermission | Where {($_.Trustee -ne 'nt authority\self') -and ($_.Trustee -ne 'Null sid')} }