Forum Discussion
naseerhaider
Sep 22, 2024Copper Contributor
Script for Automatically Removing Canceled Recurring Appointments
Hi,Is there a script that automatically removes recurring appointments from calendars when they are canceled for all active users?
Aaron_Francis530
Sep 23, 2024Copper Contributor
I don't have this process running automatically, but its worthwhile to have this process added to any off-boarding you do for accounts... 'Remove-CalendarEvents -CancelOrganizedMeetings'
# Get the username of the user running the script
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent().Name
try {
Write-Host "Enter the mailbox to be removed :" -ForegroundColor Red
Read-Host $User
$objUser = (get-mailbox $User -IncludeInactiveMailbox)
}catch{write-host "mailbox not exist"
:END}
else
{
'Removing Organised Meetings ...'
Remove-CalendarEvents -Identity $objUser.GUID -querystartdate $objUser.WhenChanged -CancelOrganizedMeetings -confirm:true -querywindowindays '90'
}
:END