Freigeben über


Gathering DAG Information - Part 1

This is a part 1 of a series of scripts one can use to gather information about your Exchange 2010 DAGs.

First, credit where credit is due. Jay Newton is who wrote the initial script, and then I went over it and helped work out some of the kinks.

This script here is to help in finding the Whitespace for an individual DAG server.

#Generate whitespace report for an individual mailbox server

#get local server name
$localserver = $env:computername

#create array of all mailbox databases hosted on local server where name starts with DAG
$mailboxdbs = get-mailboxdatabase -server $localserver -status | select-object name,mountedonserver,databasesize,availablenewmailboxspace | where-object {$_.name -like "Dag*"}

#Get information about the mount points for the DBs for each item in the array
foreach ($mailboxdb in $mailboxdbs)
    {
        $split = $($mailboxdb.name).split("-")
        $db = $split[1]
        $dbname = "*" + $db + "_data*"
        $mountinfo = Get-Wmiobject -query "select name,driveletter,capacity,freespace from win32_volume where drivetype=3" | where-object {$_.name -like $dbname }
        $mountname = $mountinfo.name
        $mountsizegb = ($mountinfo.capacity / 1gb)
        $mountfreegb = ($mountinfo.freespace / 1gb)
        $mountfreepct = ($mountfreegb*100/$mountsizegb)

        #add new array elements to represent the information returned from WMI query about the mount point
        $mailboxdb | add-member -membertype NoteProperty -Name "MountPoint" -value $mountname
        $mailboxdb | add-member -membertype NoteProperty -Name "SizeGB" -value $mountsizegb
        $mailboxdb | add-member -membertype NoteProperty -Name "FreeGB" -value $mountfreegb
        $mailboxdb | add-member -membertype NoteProperty -Name "Free%" -value $mountfreepct

        #echo results
        $mailboxdb

    }

Now, if you look closely, you will see the DB name has to start with Dag. So remember to change this to match your environment.

Here is an example output:

In part 2, we will break down the script into it's components, add the Whitespace calculation, and then return it as a property bag for SCOM.

-Jason