Tagged: SysAdmin

3 Exchange Script that can save your time

Get Total Mailbox in each Mailbox Database

$Count = @{}
$Total = 0
Get-MailboxDatabase -Identity *<DB Prefix/Suffix>* |sort Name |ForEach-Object{
$MBs = Get-Mailbox -Database $_.Name
$Total = $Total + $MBs.count
$Count.Add($_,$MBs.count)
}

$Count | sort Name | Format-Table Name, Value
Write-Host "Total = " $Total

MailboxCount

Create an Exchange mailbox database + set all the standard settings + add copy of the DB to a DAG server

$DBName = "MYDB1"
$OriCopy = "ExchangeServer1"
$DAGcopy = "ExchangeServer2"

New-MailboxDatabase -Name $DBName -Server $OriCopy -Confirm -EdbFilePath "E:\Exchange_DB\$DBName\$DBName.edb" -LogFolderPath "E:\Exchange_DB\$DBName\TL" -OfflineAddressBook "\My-OAB" -PublicFolderDatabase "My Public Folder" -Verbose
Start-Sleep -Seconds 300
Set-MailboxDatabase -Identity $DBName -RecoverableItemsQuota 512MB -RecoverableItemsWarningQuota 400MB -IssueWarningQuota 230MB -ProhibitSendQuota 245MB -ProhibitSendReceiveQuota 256MB
Start-Sleep -Seconds 10
Mount-Database -Identity $DBName
Start-Sleep -Seconds 15
Add-MailboxDatabaseCopy -Identity $DBName -MailboxServer $DAGcopy
Start-Sleep -Seconds 10
Set-MailboxDatabase $DBName -CircularLoggingEnabled $true
Dismount-Database -Identity $DBName
Start-Sleep 20
Mount-Database -Identity $DBName

Move mailbox from a DB to another if Mailbox size and Mailbox Dumpster size is match the criteria

$SourceDB = "EDB01"
$TargetDB = "EDBT01"

$mbxs = Get-Mailbox -Database $SourceDB| Get-MailboxStatistics | where {($_.TotalItemSize -lt 256MB) -and ($_.TotalDeletedItemSize -lt 512MB)}


$mbxs | ForEach-Object{

	Get-Mailbox $_.DisplayName | New-MoveRequest -TargetDatabase $TargetDB

}


Change Scope in Exchange Management Shell (EMS)

If you are an Exchange admin in a large organization where you have multiple domain in a forest and you just want to see all the Exchange object in the forest, you can use the following cmdlet

Capture

Set-AdServerSettings -ViewEntireForest $True

to change back, just change from $true to $false
Set-AdServerSettings -ViewEntireForest $false

Note:

In this mode, be careful when you ran any cmdlet as it will display all the related object in the environment if you are not careful with it. Eg. Get-Mailbox will list out all the mailbox in the forest. Imaging 20,000 mailboxes.
And to top it, Get-Mailbox -Database DBNAME | New-MoveRequest -TargetDatabase TARGETDBNAME. If you are not careful, you might move some other domain mailbox to yours. ahaha!

IBM xSeries 345: Over Spec error lights

We have an issue with one of our IBM xSeries 345 (model type 8670) server where the server went to cold boot and showing the diagnostic lights as “OVER SPEC”. The server sometimes able to boot up but it will shutdown itself when it reach RAID card checks on BIOS or when its abit to load OS.

The Solution: Change the PSU Chasis/Cage (the one that holds the PSU)