I am trying to call the Exchange cmdlets in a script that will remove any mailbox rules a user has setup when their account is deprovisioned.
I have the script below and I don't get any errors but the script isn't working, can anyone point me in the right direction?
function onPostDeprovision($Request)
. 'D:\Program Files\Microsoft\Exchange Server\V14\Bin\RemoteExchange.ps1' Connect-ExchangeServer Auto
if ($Request.Class -ne "user") { return }
Get-InboxRule -Mailbox "$Request" | Remove-InboxRule