PowerShell Script to Bulk Disable Exchange Mailboxes.
To ease some of my some of my daily activities , I have created this PowerShell script to bulk disable Exchange Mailboxes.
The script can be executed from a non Exchange PowerShell Console, it will import the Exchange PowerShell cmdlets.
The script imports a csv and runs the disable cmdlets against those mailboxes.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#Create Exchange PowerShell PSSession $s=New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri <a href="http://lazycas01/powershell">http://lazycas01/powershell</a> -Authentication Kerberos #Import Exchange PowerShell Session Import-PSSession -Session $s -AllowClobber #Import CSV Import-Csv "D:\Softlib\Scripts\Bulk-Disable-Users\DisableMBX.csv" |ForEach-Object{Get-Mailbox -identity $_.Email | Disable-Mailbox -confirm:$false} Write-Host "Mailbox has been disabled Successfully" -ForegroundColor Green |
Download Link Here
#ThatLazyAdmin