I started a deprovision task but i need some components to configure I know the power shell task to get this done not sure how to call the attributes from a deprovision script. I guess overall how would the community do it.
- Backup mailbox to PST
- setup out of office with mail access to a user in a virtual attribute
- dump mailbox folder list to a Text file
- Remove Skype licence from user on deprovision
- disable Exchange inbox rules
- clear mailbox rights
BACKUP MAILBOX TO PST
New-MailboxExportRequest -Mailbox $user -FilePath "\\SERVER\Deprovision\$($user)\PSTBackup.pst"
DUMP MAILBOX FOLDER LIST TO A TEXT FILE
Get-MailboxFolderStatistics -Identity $user | Select Name,FolderPath,FolderSize,FolderAndSubfolderSize | out-file "\\SERVER\Deprovision\$($user)\MailboxTree.txt"
REMOVE SKYPE LICENCE FROM USER ON DEPROVISION
Set-CsUser -Identity $user -Enabled $False
Disable-CsUser -Identity $user
LOG AND REMOVE MAILBOXRULES
Get-InboxRule –Mailbox $user | Select Name, Description | FL | out-file "\\SERVER\Deprovision\($user)\userrules.txt"
$currentinboxrules = Get-InboxRule -mailbox $user | select name,description
if ($currentinboxrules) {
foreach ($currentinboxrule in $currentinboxrules) {
remove-inboxrule -mailbox $user -Identity $currentinboxrule.name -confirm:$false -AlwaysDeleteOutlookRulesBlob
$currentinboxrule | FL | out-file "\\SERVER\Deprovision\($user)\userrules.txt" -append
}
}
else {
Add-Content "\\SERVER\Deprovision\($user)\userrules.txt" 'No Inbox Rules Detected for this Mailbox'
}
# OUT OF OFFICE - AUTOREPLY
$message = "$($user.firstname) $($user.lastname) is no longer with the company. For client related issues, please contact $($revieweruserinformation.firstname) $($revieweruserinformation.lastname) at $($revieweruserinformation.email)"
set-mailboxautoreplyconfiguration $user -autoreplystate enabled -externalaudience all -internalmessage $message -externalmessage $message
# OUT OF OFFICE - RULE
$message = "$($user.firstname) $($user.lastname) is no longer with the company. For client related issues, please contact $($revieweruserinformation.firstname) $($revieweruserinformation.lastname) at $($revieweruserinformation.email)"