I put this together a while back to get the whitespace report weekly....

 

May help for a starting point, the rest should be able to be pulled out
with the same array of servers and their WMI.....

 

strDate = Date()

 

Const ForWriting = 2

Const ForReading = 1

strMail = "us...@domain.com"

 

Dim fso

Dim strLogFileName

 

Set fso = CreateObject("Scripting.FileSystemObject")

strLogFileName = "Output" & "_" & Replace(Replace(replace(Now, "/",
"_"), ":", "_"), " ", "_") & ".txt"

Set fileDest = fso.OpenTextFile(strLogFileName, ForWriting, True)

fileDest.WriteLine "Begin WhiteSpace Report Script at " & now & "." &
VBCRLF

 

arrComputers = Array("exchange servers HERE")

 

Set dtmStartDate = CreateObject("WbemScripting.SWbemDateTime")

Set dtmEndDate = CreateObject("WbemScripting.SWbemDateTime")

DateToCheck = CDate(strDate)

dtmStartDate.SetVarDate DateToCheck, CONVERT_TO_LOCAL_TIME

dtmEndDate.SetVarDate DateToCheck + 1, CONVERT_TO_LOCAL_TIME

For Each strComputer In arrComputers

fileDest.WriteLine strComputer 

Set objWMIService = GetObject("winmgmts:" _

    & "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")

Set colEvents = objWMIService.ExecQuery _

    ("Select * from Win32_NTLogEvent Where Logfile = 'Application' AND "
_

            & "EventCode = '1221' AND SourceName = 'MSExchangeIS Mailbox
Store' AND TimeWritten >= '" _ 

        & dtmStartDate & "' AND TimeWritten < '" & dtmEndDate & "'") 

For Each objEvent in colEvents

    Message = objEvent.Message

    fileDest.WriteLine Message

Next

Next

fileDest.Close

 

Set fileDest = fso.OpenTextFile(strLogFileName, ForReading)

strText = fileDest.ReadAll

fileDest.Close

 

strNewText = Replace(strText, "For more information, click
http://www.microsoft.com/contentredirect.asp.";, "")

Set fileDest = fso.OpenTextFile(strLogFileName, ForWriting)

fileDest.WriteLine strNewText

fileDest.Close

 

Set fileDest = fso.OpenTextFile(strLogFileName, ForReading)

Do Until fileDest.AtEndOfStream

                strLine = fileDest.ReadLine

                strLine = Trim(strLine)

                If Len(strLine) > 0 then

                                strNewContents = strNewContents &
strLine & vbCRLF

                End If

Loop

fileDest.Close

 

Set fileDest = fso.OpenTextFile(strLogFileName, ForWriting)

fileDest.Write strNewContents

fileDest.Close

 

Set objEmail = CreateObject("CDO.Message")

                objEmail.From = "whitespacerep...@domain.com"

                objEmail.to = strMail

                objEmail.Subject = "Whitespace Weekly Report"

                objEmail.TextBody = "Script Results Log"

                objEmail.AddAttachment "D:\Whitespace\" & strLogFileName


                objEmail.Configuration.Fields.Item
("http://schemas.microsoft.com/cdo/configuration/sendusing";) = 2

                objEmail.Configuration.Fields.Item
("http://schemas.microsoft.com/cdo/configuration/smtpserver";) = "relay
server" 

                objEmail.Configuration.Fields.Item
("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = 25

                objEmail.Configuration.Fields.Update

                objEmail.Send

 

From: Ellis, John P. [mailto:johnel...@wirral.gov.uk] 
Sent: Friday, July 23, 2010 9:11 AM
To: MS-Exchange Admin Issues
Subject: RE: Exchange 2003 whitespace

 

Hi

It does help, only I've not used Powershell before. I was hoping to use
a batch file and use some command line swiches.

Looks like time to investigate PS.


Thanks

John

 

________________________________

From: Richard Stovall [mailto:rich...@gmail.com] 
Sent: 23 July 2010 13:54
To: MS-Exchange Admin Issues
Subject: Re: Exchange 2003 whitespace

Event 1221 in the Application log will tell you the amount of free space
in the db at the time of online defrag.  Can you use that plus
filesystem info. about disk space and the size of the database files to
get what you're looking for?  You could write a Powershell script using
the Get-Eventlog cmdlet to obtain the white space value, and the rest of
it should be pretty straightforward.

 

HTH,

 

RS

 

On Fri, Jul 23, 2010 at 5:01 AM, Ellis, John P.
<johnel...@wirral.gov.uk> wrote:

Is it possible to obtain free disc space, EDB size, and white space from
the command line and export it to a file?

Thanks
John
-------------------------------------------------------------------

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.clearswift.com
**********************************************************************





 

Reply via email to