Enable or Disable Exchange features (OWA, ActiveSync, MAPI, POP3, IMAP) for specified mailbox in the case you need to "pause" it
In certain cases you need to pause access to the user's mailbox without disabling user's account or Exchange mailbox. Therefore mailbox features should be disabled. I created a simple script that disables or enables all mailbox features on specified mailbox. You can download the script here Pause_Mailbox_Features_For_Mailbox.ps1
# -----------------------------------------------------------------------------------
#
# Enter mailbox name you want to "pause". Use Get-Mailbox command to get correct name
#
# Be careful when using this script since it disables or enables Exchange features
# for a specified user mailbox.
#
# If this is not your intention, don't use it.
# This script is provided "AS IS" with no warranties, and confers no rights.
#
# Check www.exchangelog.info for more useful information
#
#------------------------------------------------------------------------------------
# BEGIN script
$User = read-host "Please enter the users mailbox name";
$caption = "Disable / Enable";
$message = "What do you want to do with mailbox features, Enable or Disable them?";
$Enabled = new-Object System.Management.Automation.Host.ChoiceDescription "&Enable";
$Disabled = new-Object System.Management.Automation.Host.ChoiceDescription "&Disable";
$choices = [System.Management.Automation.Host.ChoiceDescription[]]($Disabled,$Enabled);
$answer = $host.ui.PromptForChoice($Caption,$message,$choices,0);
#Disable Exchange features for specified mailbox
#Disable OWA
Set-CASMailbox -id $User -OWAEnabled $answer
if($answer -eq '0') {
Write-Host "OWA disabled"
} else {
Write-Host "OWA is enabled"
}
#Disable ActiveSync
Set-CASMailbox -id $User -ActiveSyncEnabled $answer
if($answer -eq '0') {
Write-Host "ActiveSync disabled"
} else {
Write-Host "ActiveSync is enabled"
}
#Disable MAPI
Set-CASMailbox -id $User -MAPIEnabled $answer
if($answer -eq '0') {
Write-Host "MAPI disabled"
} else {
Write-Host "MAPI is enabled"
}
#Disable POP3
Set-CASMailbox -id $User -PopEnabled $answer
if($answer -eq '0') {
Write-Host "POP3 disabled"
} else {
Write-Host "POP3 is enabled"
}
#Disable IMAP
Set-CASMailbox -id $User -IMAPEnabled $answer
if($answer -eq '0') {
Write-Host "IMAP disabled"
} else {
Write-Host "IMAP is enabled"
}
# END script
# -----------------------------------------------------------------------------------
#
# Enter mailbox name you want to "pause". Use Get-Mailbox command to get correct name
#
# Be careful when using this script since it disables or enables Exchange features
# for a specified user mailbox.
#
# If this is not your intention, don't use it.
# This script is provided "AS IS" with no warranties, and confers no rights.
#
# Check www.exchangelog.info for more useful information
#
#------------------------------------------------------------------------------------
# BEGIN script
$User = read-host "Please enter the users mailbox name";
$caption = "Disable / Enable";
$message = "What do you want to do with mailbox features, Enable or Disable them?";
$Enabled = new-Object System.Management.Automation.Host.ChoiceDescription "&Enable";
$Disabled = new-Object System.Management.Automation.Host.ChoiceDescription "&Disable";
$choices = [System.Management.Automation.Host.ChoiceDescription[]]($Disabled,$Enabled);
$answer = $host.ui.PromptForChoice($Caption,$message,$choices,0);
#Disable Exchange features for specified mailbox
#Disable OWA
Set-CASMailbox -id $User -OWAEnabled $answer
if($answer -eq '0') {
Write-Host "OWA disabled"
} else {
Write-Host "OWA is enabled"
}
#Disable ActiveSync
Set-CASMailbox -id $User -ActiveSyncEnabled $answer
if($answer -eq '0') {
Write-Host "ActiveSync disabled"
} else {
Write-Host "ActiveSync is enabled"
}
#Disable MAPI
Set-CASMailbox -id $User -MAPIEnabled $answer
if($answer -eq '0') {
Write-Host "MAPI disabled"
} else {
Write-Host "MAPI is enabled"
}
#Disable POP3
Set-CASMailbox -id $User -PopEnabled $answer
if($answer -eq '0') {
Write-Host "POP3 disabled"
} else {
Write-Host "POP3 is enabled"
}
#Disable IMAP
Set-CASMailbox -id $User -IMAPEnabled $answer
if($answer -eq '0') {
Write-Host "IMAP disabled"
} else {
Write-Host "IMAP is enabled"
}
# END script
Comments
Post a Comment