We use the following script to report on Exchange 2007 Mailbox Database usage.
I will be modifying it for 2010 soon – watch this space 🙂
001
002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 |
# Script to show the size and mailbox count of all databases
# Karl Mitschke 4/9/2008 # Modified 1/26/2010 to gather whitespace information #requires -pssnapin Microsoft.Exchange.Management.PowerShell.Admin # Get-ExchangeWhiteSpace from Shay Levi’s blog param( # Convert Dates to WMI CIM dates #Create a hash Table to hold the freespace information # Create two claculated properties for InsertionStrings values $freespace = Get-WMIObject Win32_NTLogEvent -ComputerName $ComputerName -Filter "LogFile=’Application’ AND EventCode=1221 AND TimeWritten>=’$Start’ AND TimeWritten<=’$End’" | Select-Object $DB,$FreeMB | Sort-Object FreeMB –Unique –Descending $date = ( get-date ).ToString(‘MM-dd-yyyy’) $AllServers = @() $body = "<font color=blue>Mailbox database size report for $date<br /><br />" |
Here is a sample output:
Mailbox database size report for 01-26-2010
Server\StorageGroup\Database
|
Total Size (GB)
|
Used Space (GB)
|
Free Space (GB)
|
Percent Disk Free
|
User Mailbox Count
|
White Space (GB)
|
Total Free (GB)
|
Total Percent Free
|
Server1\StorageGroup1\Mail1 |
39.99 |
25.92 |
11.40 |
28.51 |
553 |
2.93 |
14.33 |
35.84 |
Server1\StorageGroup2\Mail2 |
39.99 |
28.76 |
8.72 |
21.79 |
625 |
2.75 |
11.47 |
28.68 |
Server2\StorageGroup1\Mail1 |
30.00 |
23.25 |
3.81 |
12.69 |
477 |
2.41 |
6.22 |
20.74 |
Server3\StorageGroup1\Mail1 |
30.00 |
12.60 |
15.04 |
50.14 |
206 |
1.43 |
16.47 |
54.91 |
Server3\StorageGroup2\Mail2 |
39.99 |
25.84 |
13.15 |
32.88 |
439 |
3.38 |
16.53 |
41.34 |
Server3\StorageGroup3\Mail3 |
30.00 |
15.00 |
13.41 |
44.70 |
233 |
1.45 |
14.86 |
49.54 |
Server3\StorageGroup4\Mail4 |
50.00 |
35.49 |
12.48 |
24.97 |
707 |
1.96 |
14.44 |
28.89 |
#1 by Link by umeee on February 5, 2010 - 13:45
thanks its helped me alot
#2 by karlmitschke on February 5, 2010 - 16:08
Glad to help.
Karl
#3 by Roy on February 13, 2010 - 13:48
Hi Karl,
I appreciate if you post the script which works for powrshell v1. Tahnks
#4 by karlmitschke on February 16, 2010 - 15:40
Roy;
I will try to get to that this week – as far as I remember, the only thing that needs modifying is hte last line, “Send-MailMessage” as Send-MailMessage doesn’t exist in v1.
Change that as:
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = “mail.contoso.com”
$mailmessage.from = “mailboxdatabaseizereport@noreply.com”
$mailmessage.To.add(“kmitschke@contoso.com”)
$mailmessage.Subject = “Mailbox Database Size Report”
$mailmessage.Body = $body
$MailMessage.IsBodyHtml = $TRUE
$smtpclient.Send($mailmessage)
#5 by Roy on February 16, 2010 - 19:34
Thanks it worked, however I can not get any result for User Maibox Count column, the script returns the follwoing errors, any idea:
At C:\R1.ps1:50 char:50
+ $disconnectedmailboxcount = Get-MailboxStatistics <<<< -database "$mailboxpa
th" |Where {$_.DisconnectDate -ne $null} |measure-object
Get-MailboxStatistics : The specified mailbox database "mbx16\SG14\MDB" does no
t exist.
At C:\R1.ps1:49 char:38
+ $mailboxcount = Get-MailboxStatistics <<<< -database "$mailboxpath" |Where {
$_.DisconnectDate -eq $null -and $_.ObjectClass -eq `Mailbox'} |measure-object
Get-MailboxStatistics : The specified mailbox database "mbx16\SG14\MDB" does no
t exist.
At C:\R1.ps1:50 char:50
+ $disconnectedmailboxcount = Get-MailboxStatistics <<<< -database "$mailboxpa
th" |Where {$_.DisconnectDate -ne $null} |measure-object
Get-WmiObject : Invalid query
At C:\R1.ps1:28 char:27
+ $freespace = Get-WMIObject <<<=’$Start’ AN
D TimeWritten<='$End'" | Select-Object $DB,$FreeMB | Sort-Object FreeMB -Unique
-Descending
Exception calling "Add" with "2" argument(s): "Key cannot be null.
Parameter name: key"
#6 by karlmitschke on February 17, 2010 - 00:41
Roy;
Does that database exist?
Karl
#7 by karlmitschke on February 19, 2010 - 20:41
Roy;
Kill this line, and try it again:
“$disconnectedmailboxcount = Get-MailboxStatistics -database “$mailboxpath” |Where {$_.DisconnectDate -ne $null} |measure-object
”
Karl
#8 by Steven on February 19, 2010 - 14:50
I’m getting the following errors for database:
Get-MailboxStatistics : Cannot bind parameter ‘Database’. Cannot convert value
“EXTLAB\Program Files\Microsoft\Exchange Server\Mailbox\extlab-CDSGE5000\extlab
-CDSGE5000” to type “Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter
“. Error: “‘EXTLAB\Program Files\Microsoft\Exchange Server\Mailbox\extlab-CDSGE
5000\extlab-CDSGE5000’ is not a valid value for the identity.
Parameter name: Identity”
At C:\getDBinfo2.ps1:44 char:48
+ $mailboxcount = Get-MailboxStatistics -database <<<< "$mailboxpath" |Where {
$_.DisconnectDate -eq $null -and $_.ObjectClass -eq `Mailbox'} |measure-object
+ CategoryInfo : InvalidArgument: (:) [Get-MailboxStatistics], Pa
rameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Exchang
e.Management.MapiTasks.GetMailboxStatistics
Get-MailboxStatistics : Cannot bind parameter 'Database'. Cannot convert value
"EXTLAB\Program Files\Microsoft\Exchange Server\Mailbox\extlab-CDSGE5000\extlab
-CDSGE5000" to type "Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter
". Error: "'EXTLAB\Program Files\Microsoft\Exchange Server\Mailbox\extlab-CDSGE
5000\extlab-CDSGE5000' is not a valid value for the identity.
Parameter name: Identity"
At C:\getDBinfo2.ps1:45 char:60
+ $disconnectedmailboxcount = Get-MailboxStatistics -database <<<< "$mailboxpa
th" |Where {$_.DisconnectDate -ne $null} |measure-object
+ CategoryInfo : InvalidArgument: (:) [Get-MailboxStatistics], Pa
rameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Exchang
e.Management.MapiTasks.GetMailboxStatistics
The odd thing is, I've been using one of your older scripts (http://powershellcommunity.org/Forums/tabid/54/afv/topic/aff/3/aft/1110/afpg/1/Default.aspx) and it works perfectly…
#9 by karlmitschke on February 19, 2010 - 16:42
Steven;
I’ll take a look at this.
Out of curiosity, which script on that page were you using (out of the 7 pages) 😉
Karl
#10 by Steven on February 19, 2010 - 19:04
Sorry! 🙂
$exchangeservers = Get-ExchangeServer |where-object {$_.admindisplayversion.major -eq 8 -and $_.IsMailboxServer -eq $true }
$AllServers = @()
foreach ($server in $exchangeservers)
{
$db = Get-MailboxDatabase -server $server
foreach ($objItem in $db)
{
$edbfilepath = $objItem.edbfilepath
$path = “`\`\” + $server + “`\” + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + “$”+ $objItem.EdbFilePath.PathName.Remove(0,2)
$dbsize = Get-ChildItem $path
$DiskObj = get-WmiObject Win32_LogicalDisk -computerName $server | Where-Object { $_.DriveType -eq 3 -and $_.DeviceID -ieq $objItem.EdbFilePath.DriveName}
$FreeOnStorage = [double]($DiskObj.freespace)
# $FreeOnStorageProc = [float](($DiskObj.freespace /$Jumbo) / ($DiskObj.size / $Jumbo))
$start = $path.LastIndexOf(‘\’)
$dbpath = $path.Substring($start +1).remove($path.Substring($start +1).length -4)
$mailboxpath = “$server\$dbpath”
$mailboxcount = Get-MailboxStatistics -database “$mailboxpath” |measure-object
$ReturnedObj = New-Object PSObject
$ReturnedObj | Add-Member NoteProperty -Name “Server\StorageGroup\Database” -Value $objItem.Identity
$ReturnedObj | Add-Member NoteProperty -Name “Size (MB)” -Value (“{0:n2}” -f ($dbsize.Length/1024KB))
$ReturnedObj | Add-Member NoteProperty -Name “Mailbox Count” -Value $mailboxcount.count
$ReturnedObj | Add-Member NoteProperty -Name “FreeOnStorage (MB)” -Value (“{0:n2}” -f ($FreeOnStorage/1024KB))
# $ReturnedObj | Add-Member NoteProperty -Name “FreeOnStorageProc” -Value $FreeOnStorageProc
$AllServers += $ReturnedObj
}
}
$AllServers |export-csv c:\test2.csv -notype -force | Sort $mailboxpath
#11 by karlmitschke on February 19, 2010 - 20:40
Steven;
Try this:
. C:\getDBinfo2.ps1
$mailboxpath
$server
$dbpath
Tell me what you get for each variable.
Karl
#12 by Steven on February 19, 2010 - 21:57
Nothing for each. No information, no errors. Those variable did return the correct information last week when I was working with the other script…
#13 by karlmitschke on February 24, 2010 - 22:49
Steven;
Try this:
foreach ($server in Get-MailboxServer)
{
foreach ($objItem in Get-MailboxDatabase -server $server)
{
$edbfilepath = $objItem.edbfilepath
$dbpath = $EdbFilePath.PathName.Remove(0,2).remove($EdbFilePath.PathName.length-6)
$mailboxpath = “$server$dbpath”
write-host $server.name $mailboxpath $dbpath
}
}
Does that return data?
#14 by Steven on November 30, 2010 - 13:55
Sorry for the delay. I’m just now getting back to this due to other projects. The suggestion you made on 2/24/2010 does return data.
#15 by Karl Mitschke on December 1, 2010 - 19:36
Glad to hear it!
#16 by Mithun on March 2, 2010 - 19:15
Hi Karl,
Do we need to update edit any fields in the script, because when iam running this script and get same error as steven.
Regards,
Mithun
#17 by karlmitschke on March 2, 2010 - 21:04
Mithun;
I am still trying to find the error.
Did you run the test I asked Steven to run?
Karl
#18 by Mithun on March 4, 2010 - 04:34
foreach ($server in Get-MailboxServer)
{
foreach ($objItem in Get-MailboxDatabase -server $server)
{
$edbfilepath = $objItem.edbfilepath
$dbpath = $EdbFilePath.PathName.Remove(0,2).remove($EdbFilePath.PathName.length-6)
$mailboxpath = “$server$dbpath”
write-host $server.name $mailboxpath $dbpath
}
}
you want me to run this and check if i get some data,
#19 by karlmitschke on March 4, 2010 - 14:57
Yes, please 🙂
#20 by Mithun on March 4, 2010 - 15:50
Yes I get the details of server and storage group in Below format
“server\Mnt\DB\ExchSrvr\storage group \Mnt\DB\ExchSrvr\Storage group
#21 by Mithun on March 4, 2010 - 15:51
Hi Karl,
I have one more query could you please help me with this
We are using exchange 2007 .Using powershell how can we extract the list of Acceptmessagesonlyfrom from a mail
We used the following cmdlets: –
get-mailbox “user logon” |fl acceptmessagesonlyfrom,acceptmessagesonlyfromdlmembers |out-file “c:/output/”
its is not giving complete list it just gives 16 users not more than that , do you have any solution?
#22 by karlmitschke on March 12, 2010 - 14:58
Mithun;
I suggest never using a format-* cmdlet on anything you will be sending down the pipeline.
Try this and see if it helps:
get-mailbox “user logon” |Select-Object acceptmessagesonlyfrom,acceptmessagesonlyfromdlmembers |out-file “c:/output/file”
#23 by karlmitschke on March 18, 2010 - 16:13
Mithun;
Try’s this:
function Convert-LocalPathToUNC
{
param(
[string]$ComputerName=$env:COMPUTERNAME,
[string]$Path=$(throw “Path cannot be empty.”)
)
if(Test-Path $Path -IsValid)
{
$Path -replace “^(.)(.)”,”\\$computerName\`$1$”
}
else
{
Write-Error “Invalid Path. The syntax of the path is incorrect.”
}
}
Get-ExchangeServer | where {$_.admindisplayversion.major -eq 8 -and $_.IsMailboxServer} | Foreach-Object{
$server = $_
$_ | Get-MailboxDatabase | Select-Object @{n=”Server”;e={$server.Name}},Name,EdbFilePath,@{n=”Size(MB)”;e={ (dir (Convert-LocalPathToUNC -ComputerName $server.Name -Path $_.EdbFilePath)).Length/1MB }},DistinguishedName
} | Sort-Object “Size(MB)”
from:
http://powershellcommunity.org/Forums/tabid/54/aff/3/aft/4726/afv/topic/afpgj/1/Default.aspx#8999
Does that return data?
If so, i ewill modify my script.
#24 by Sandeep on March 11, 2010 - 17:27
Karl,
I get following output in addition to DB names
Total Size (GB) Used Space (GB) Free Space (GB) Percent Disk Free User Mailbox Count White Space (GB) Total Free (GB) Total Percent Free
1.00 124.03 0.97 96.73 0 0.00 0.97 96.73
1.00 105.36 0.97 96.73 0 0.00 0.97 96.73
1.00 78.25 0.97 96.73 0 0.00 0.97 96.73
1.00 82.66 0.97 96.73 0 0.00 0.97 96.73
1.00 75.01 0.97 96.73 0 0.00 0.97 96.73
1.00 78.99 0.97 96.73 0 0.00 0.97 96.73
1.00 82.40 0.97 96.73 0 0.00 0.97 96.73
1.00 79.61 0.97 96.73 0 0.00 0.97 96.73
1.00 86.01 0.97 96.73 0 0.00 0.97 96.73
1.00 86.87 0.97 96.73 0 0.00 0.97 96.73
1.00 83.60 0.97 96.73 0 0.00 0.97 96.73
1.00 87.51 0.97 96.73 0 0.00 0.97 96.73
1.00 76.42 0.97 96.73 0 0.00 0.97 96.73
1.00 50.82 0.97 96.73 0 0.00 0.97 96.73
1.00 79.90 0.97 96.73 0 0.00 0.97 96.73
1.00 58.44 0.97 96.73 0 0.00 0.97 96.73
1.00 31.01 0.97 96.73 0 0.00 0.97 96.73
1.00 72.80 0.97 96.73 0 0.00 0.97 96.73
Now this isnt correct size of the stores, as well number of users are zero & it doesnt give the white space details..here the difference could be that my database are on different mount points..could that be changed in the script?
#25 by karlmitschke on March 12, 2010 - 14:55
I am going to have to look at this in depth soon.
I have no mount points to work with, but I will try to spin up a new VM shortly.
#26 by Thomas on March 22, 2010 - 14:30
I am getting the following error when running the script
Get-WmiObject : Invalid query
At C:\Scripts\mbstoragereport.ps1:28 char:27
+ $freespace = Get-WMIObject <<<< Win32_NTLogEvent -ComputerName $ComputerName
-Filter "LogFile='Application' AND EventCode=1221" | Select-Object $DB,$FreeMB
| Sort-Object FreeMB -Unique -Descending
Exception calling "Add" with "2" argument(s): "Key cannot be null.
Parameter name: key"
At C:\Scripts\mbstoragereport.ps1:29 char:45
+ $freespace | ForEach-Object {$whiteSpace.Add( <<<< $_.DB,$_.FreeMB)}
Get-MailboxStatistics : Cannot bind parameter 'Database'. Cannot convert value
"EXCH-MBX01\Program Files\Microsoft\Exchange Server\Mailbox\Mailbox Database 2"
to type "Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter". Error: "
'EXCH-MBX01\Program Files\Microsoft\Exchange Server\Mailbox\Mailbox Database 2'
is not a valid value for the identity.
Parameter name: Identity"
At C:\Scripts\mbstoragereport.ps1:49 char:48
+ $mailboxcount = Get-MailboxStatistics -database <<<< "$mailboxpath" |Where {
$_.DisconnectDate -eq $null -and $_.ObjectClass -eq `Mailbox'} |measure-object
Get-MailboxStatistics : Cannot bind parameter 'Database'. Cannot convert value
"EXCH-MBX01\Program Files\Microsoft\Exchange Server\Mailbox\Mailbox Database 2"
to type "Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter". Error: "
'EXCH-MBX01\Program Files\Microsoft\Exchange Server\Mailbox\Mailbox Database 2'
is not a valid value for the identity.
Parameter name: Identity"
At C:\Scripts\mbstoragereport.ps1:50 char:60
+ $disconnectedmailboxcount = Get-MailboxStatistics -database <<<< "$mailboxpa
th" |Where {$_.DisconnectDate -ne $null} |measure-object
Get-MailboxStatistics : The specified mailbox database "EXCH-MBX01\ForthStorage
Group\Storage Group MB3" does not exist.
At C:\Scripts\mbstoragereport.ps1:49 char:38
+ $mailboxcount = Get-MailboxStatistics <<<< -database "$mailboxpath" |Where {
$_.DisconnectDate -eq $null -and $_.ObjectClass -eq `Mailbox'} |measure-object
Get-MailboxStatistics : The specified mailbox database "EXCH-MBX01\ForthStorage
Group\Storage Group MB3" does not exist.
At C:\Scripts\mbstoragereport.ps1:50 char:50
+ $disconnectedmailboxcount = Get-MailboxStatistics <<<< -database "$mailboxpa
th" |Where {$_.DisconnectDate -ne $null} |measure-object
Get-MailboxStatistics : The specified mailbox database "EXCH-MBX01\FifthStorage
Group\Storage Group MB4" does not exist.
At C:\Scripts\mbstoragereport.ps1:49 char:38
+ $mailboxcount = Get-MailboxStatistics <<<< -database "$mailboxpath" |Where {
$_.DisconnectDate -eq $null -and $_.ObjectClass -eq `Mailbox'} |measure-object
Get-MailboxStatistics : The specified mailbox database "EXCH-MBX01\FifthStorage
Group\Storage Group MB4" does not exist.
At C:\Scripts\mbstoragereport.ps1:50 char:50
+ $disconnectedmailboxcount = Get-MailboxStatistics <<<< -database "$mailboxpa
th" |Where {$_.DisconnectDate -ne $null} |measure-object
Get-MailboxStatistics : The specified mailbox database "EXCH-MBX01\FirstStorage
Group\FirstStorageGroup" does not exist.
At C:\Scripts\mbstoragereport.ps1:49 char:38
+ $mailboxcount = Get-MailboxStatistics <<<< -database "$mailboxpath" |Where {
#27 by karlmitschke on March 23, 2010 - 17:29
Thomas;
I will take a look at this;
In the mean time, does this return anything?
Get-WMIObject Win32_NTLogEvent -ComputerName -Filter “LogFile=’Application’ AND EventCode=1221”
Karl
#28 by stevos on April 20, 2010 - 07:32
i have the same issue as thomas.
was there a resolution to this?
#29 by karlmitschke on April 20, 2010 - 13:54
No resolution yet – Can you tell me if this returns anything?
Get-WMIObject Win32_NTLogEvent -ComputerName -Filter “LogFile=’Application’ AND EventCode=1221″
Karl
#30 by stevos on April 20, 2010 - 23:43
Get-WmiObject : Missing an argument for parameter ‘ComputerName’. Specify a par
ameter of type ‘System.String[]’ and try again.
At line:1 char:45
+ Get-WMIObject Win32_NTLogEvent -ComputerName <<<< -Filter "LogFile='Applicat
ion' AND EventCode=1221"
+ CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ParameterB
indingException
+ FullyQualifiedErrorId : MissingArgument,Microsoft.PowerShell.Commands.Ge
tWmiObjectCommand
#31 by Katherine Bargas on March 22, 2010 - 21:38
I have Exchange 2007 SP2 and loaded Powershell 2 on my server. From my server I do not get the command get-exchangewhitespace. It says this is not a recognized cmdlet. What do I need to load in order to get this command?
#32 by karlmitschke on March 23, 2010 - 16:35
Katherine;
Get-ExchangeWhiteSpace is a function at the top of the script, npt a cmdlet 🙂
#33 by karlmitschke on April 20, 2010 - 17:23
For folks who are using mountpoints, please send me email at karlmitschke at hotmail dot com, and I will send you a test script to see if we can start gathering these data.
Thanks
Karl
#34 by stevos on April 21, 2010 - 03:44
if i remove the computername parameter i get
Get-WmiObject : Invalid query
At line:1 char:14
+ Get-WMIObject <<<< Win32_NTLogEvent -Filter "LogFile='Application' AND Event
Code=1221"
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], Managemen
tException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.C
ommands.GetWmiObjectCommand
if i reduce the filter and enter;
[Get-WMIObject Win32_NTLogEvent – Filter "EventCode=1221"
i get all the 1221 events scrolling past for the exchage server i am on.
#35 by karlmitschke on April 21, 2010 - 14:14
Hi – I should have specified that you need to put the name of an exchange server after -ComputerName
Karl
#36 by stevos on April 21, 2010 - 22:39
Hi Karl, yes figured that out eventually. appears to be something to do with the query though as when i reduced the filter down to just “EventCode=1221” it worked
#37 by stevos on April 21, 2010 - 23:40
if i run this;
function Get-ExchangeWhiteSpace {
param(
$ComputerName = $(throw “ComputerName cannot be empty.”)
)
# Convert Dates to WMI CIM dates
$tc = [System.Management.ManagementDateTimeconverter]
$Start =$tc::ToDmtfDateTime( (Get-Date).AddDays(-1).Date )
$End =$tc::ToDmtfDateTime( (Get-Date).Date)
# Create two claculated properties for InsertionStrings values
$DB = @{Name=”DB”;Expression={$_.InsertionStrings[1]}}
$FreeMB = @{Name=”FreeMB”;Expression={[int]$_.InsertionStrings[0]}}
Get-WMIObject Win32_NTLogEvent -ComputerName $ComputerName -Filter “LogFile=’Application’ AND EventCode=1221 AND TimeWritten>=’$Start’ AND TimeWrittenc:\whitspacetest.txt
I get this in the text file
ComputerName DB FreeMB
———— — ——
SERVERNAME XXXXXXX Storage Group 5\Mailbox Database 5 4324
SERVERNAME XXXXXXX Storage Group 7\Mailbox Database 7 481
SERVERNAME XXXXXXX Storage Group 6\Mailbox Database 6 149
SERVERNAME XXXXXXX Storage Group 8\Mailbox Database 8 128
SERVERNAME XXXXXXX Public Folder Storage Group 2\Public Folder Database 2 7
#38 by stevos on April 21, 2010 - 23:45
sorry that didn’t paste properly in the previous post – it’s basically the original script from the blog regarding whitespace. the time written line and the line i called the function from have been merged by the look of it
#39 by Kirk on April 29, 2010 - 19:07
Anybody get this to work with CCR mailbox servers running Win2008 ?
It works fine with Win2003 CCR mailbox servers.
On line 31: Get-Mailboxserver returns the “Network Name” cluster resource. Not the actual hostname of the active node of the cluster.
By default In Win2008 clustering…. you cannot browse shares using the cluster resource “network name”. You have to use the actual hostname.
This is a recommended security best practice and configured by default when you create clustered resouces.
#40 by karlmitschke on April 30, 2010 - 19:57
Thanks, Kirk – i will look at this.
#41 by Budakkan on June 21, 2010 - 17:02
I am with Kirk on this. CCR on Win2k8 requires you to use the hostname. Any help in this scenario would be much appreciated Karl.
#42 by karlmitschke on June 25, 2010 - 18:57
Thanks for the reminder – I will put some more time into this.
#43 by karlmitschke on June 25, 2010 - 19:00
Kirk and Budakkan;
Can you replace the Get-MailboxServer on 31 with Get-ClusteredMailboxServer?
#44 by Kirk on August 6, 2010 - 15:11
“get-clusteredmailboxserver” is not a valid command on my Exch2007 boxes.
is that an Exch2010 command ?
If I run “Get-ClusteredMailboxServerStatus”… it returns data.
However, that command pukes if running it from a stand-alone Exchange server (not-CCR enabled).
– Get-ClusteredMailboxServerStatus : Server MBX02 is not clustered. This task requires a clustered mailbox server.
We have one utility server that is standalone where we run scheduled jobs and scripts… along with 7 CCR Win2008 production mailbox server pairs.
#45 by Jack on July 21, 2010 - 00:20
I get:
Get-WmiObject : Invalid query
At C:\Documents and Settings\tmc_jtucci\My Documents\Powershell\whitespace.ps1:14 char:27
+ $freespace = Get-WMIObject <<<=’$Start’ AND TimeWritten<='$End'" | Select-Object $DB,$FreeMB | Sort-Object FreeMB -Unique
-Descending
Exception calling "Add" with "2" argument(s): "Key cannot be null.
Parameter name: key"
At C:\Documents and Settings\tmc_jtucci\My Documents\Powershell\whitespace.ps1:15 char:45
+ $freespace | ForEach-Object {$whiteSpace.Add( <<<< $_.DB,$_.FreeMB)}
When I try to run the get-whitespace function. I too can only get the filter to work if I remove everything but the EventCode=1221. Has anyone resolved this?
Thanks,
Jack
#46 by karlmitschke on July 26, 2010 - 14:10
Jack;
Can you change the start date as
$Start =$tc::ToDmtfDateTime( (Get-Date).AddDays(-2).Date ) (should be line 7 in your version of the script)
Karl
#47 by Kloecker on August 5, 2010 - 10:49
Hello,
i get results for these commands,
but in the script,
the result of $MountPoint = . Get-MountPointInfo $ServerName is $null and so
the next if sequences goes into the fault directions.
#48 by Kloecker on August 5, 2010 - 11:25
Hello,
i think i know, where the problem on our Exchange Servers is:
On each mountpoints, we have for each Storagegroup an own directory like M:\DB_SG06-SG10\SG08,
but in the result of the mountpoints-query are only the path M:\DB_SG06-SG10 stored.
How could the script changed, that this works for us too?
Ansgar
#49 by Nickb on November 17, 2010 - 13:29
Hi-
I am getting the following error when trying to run the script.
The script ‘whitespace2.ps1’ cannot be run because the following snap-ins that are specified by the “#requires” statements
of the script are missing: Microsoft.Exchange.Management.PowerShell.Admin.
At line:1 char:2
+ . <<<< 'C:\PS1_Scripts\whitespace2.ps1'
+ CategoryInfo : ResourceUnavailable: (whitespace2.ps1:String) [], ScriptRequiresException
+ FullyQualifiedErrorId : ScriptRequiresMissingPSSnapIns
When I try to add in the Microsoft.Exchange.Management.PowerShell.Admin snap-in it says its already there. I've updated my tools to SP3 and tried again, but to no avail.
Can you direct me to where I may find an updated version of the snapin if I don't have it already?
Thanks,
Nick
#50 by karlmitschke on November 17, 2010 - 22:12
Nick;
Try removing the #requires line 😉
Karl
#51 by sam on December 18, 2010 - 19:07
i’m still trying to fill in the blanks. My environment is currently configured as such: ccr cluster, win2008 vm servers, exchange 2007 sp2 , san fc storage. the example of my server names, storage group names and database names is as follow: servername= mail-mb-01, storage group name= sgjb01 and database name=db-01. the question is where do i fill in my relevant information to get the script to out-put Mailbox database size report? thanks!
#52 by Karl Mitschke on December 24, 2010 - 11:34
I will look at this after Christmas
#53 by Vinod Kumar on January 19, 2011 - 06:42
Hi ,
i want to get report for only one exchange server , please modify and post .
thank
vino
#54 by Karl Mitschke on January 19, 2011 - 09:07
Vino;
Modify this line:
foreach ($server in Get-MailboxServer)
To:
foreach ($server in Get-MailboxServer )
Karl
#55 by Vinod Kumar on February 25, 2011 - 02:49
Karl ,
looks same , i am new for scripting . can you please write in details .
thanks
vi
#56 by Alzer on February 13, 2011 - 16:32
This script looks great… I’m very new to powershell and a ‘Junior’ exchange administrator… I’ve tinkered about with the script but I’ve not been successful. Before I post up the errors I’d like to confirm what, where and how I need to enter information, of our environment, in to the script?
Thanks in advance
#57 by Karl Mitschke on August 23, 2011 - 08:28
I cannot remember if we resolved this through email.
If you still have issues. please let me know
#58 by albertwt on February 21, 2011 - 16:49
Thanks Karl for sharing such a great script here, however when I run it on my laptop the following columns are empty “Used Space (GB), User Mailbox Count, Total Percent Free”
my Exchange server is CCR with 10 drives attached, while the other remaining columns were OK.
#59 by Karl Mitschke on February 24, 2011 - 13:40
Can you try my newer script?
https://unlockpowershell.wordpress.com/2010/06/06/exchange-2007-2010-database-reporting-script/
Karl
#60 by Prince on January 4, 2012 - 06:38
Hi Karl,
This could be ery usefull for me, if you could help me to run the same in Powershell version 1
#61 by Karl Mitschke on January 4, 2012 - 08:24
As far as I can see, with a quick perusal, just remove the “#requires -version 2” line 🙂
#62 by Prince on January 5, 2012 - 00:46
Hi Karl,
Thank you so much for help, but now it is coming with the error below
Get-WmiObject : Invalid query
At E:\SCRP\New.ps1:27 char:27
+ $freespace = Get-WMIObject <<<=’$Start’ AN
D TimeWritten<='$End'" | Select-Object $DB,$FreeMB | Sort-Object FreeMB -Unique
-Descending
Exception calling "Add" with "2" argument(s): "Key cannot be null.
Parameter name: key"
At E:\SCRP\New.ps1:28 char:45
+ $freespace | ForEach-Object {$whiteSpace.Add( <<<< $_.DB,$_.FreeMB)}
Get-MailboxStatistics : Cannot bind parameter 'Database'. Cannot convert value
"NDA-HCLIN-HT01\Program Files\Microsoft\Exchange Server\Mailbox\First Storage G
roup\Mailbox Database" to type "Microsoft.Exchange.Configuration.Tasks.Database
IdParameter". Error: "'NDA-HCLIN-HT01\Program Files\Microsoft\Exchange Server\M
ailbox\First Storage Group\Mailbox Database' is not a valid value for the ident
ity.
Please help.
#63 by Prince on January 5, 2012 - 04:09
i am also getting the below error , even after runnig the script using domain admin user…..
Please suggest…
Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x80070
6BA)
At E:\SCRP\New.ps1:27 char:27
+ $freespace = Get-WMIObject <<<=’$Start’ AN
D TimeWritten<='$End'" | Select-Object $DB,$FreeMB | Sort-Object FreeMB -Unique
-Descending
Exception calling "Add" with "2" argument(s): "Key cannot be null.
Parameter name: key"
At E:\SCRP\New.ps1:28 char:45
+ $freespace | ForEach-Object {$whiteSpace.Add( <<<< $_.DB,$_.FreeMB)}
#64 by Somtirtha Das on January 12, 2012 - 08:27
HI Karl…are u still chekcing this post…i want a urgent help
#65 by Karl Mitschke on January 25, 2012 - 08:29
Yes, I am.