Pass Script to Set Remote Mailbox to shared

Pass Script to Set Remote Mailbox to shared

Dear all, we have a Exchange hybrid configuration and I would like to
set migrated mailboxes to shared during user the offboarding process. ADManager seems to support only “convert to shared” for Exchange Online Mailboxes but running that only wouldn’t set the mailbox to Shared on Prem as well. The solution to this is to Run Set-Remotemailbox “username@contoso.com” -Type Shared locally on the onprem exchange server. 

My question is how can I pass on this syntax to the user modification template applying the user mail. I do understand ADManager supports running scripts on successful template appliance.. but how can I apply this. Do I need to connect to the onprem exchange Server within the script or will ADManager do that automatically because it already has permissions to the onPrem Exchange? Do I put in the variable %mail% into the  -Identity Value or is the script run process  just supposed to be SetToShared.ps1  %mail%

Thanks

                New to ADSelfService Plus?