Office 365 Service Health Check [.NET]
Tool Overview
Sample Report
AlertO365 1.2 - https://github.com/junecastillote/AlertO365
Note: Download contains source code. If you want to just get the binary output and associated files listed in "Files and Folders" section above, just go to the "bin/Release" folder.
The AlertO365 Tool provides a mechanism to check the Office 365 Service Status and Events programmatically eliminating the need to logon to the Office 365 Portal manually. This tool utilize the “Office 365 Service Communications API” as provided by Microsoft.
Reference: https://msdn.microsoft.com/en-us/library/office/dn776043.aspx
The Package
Files and Folders
Name
|
Type
|
Description
|
AlertO365.exe
|
File
|
Main executable (no parameter required)
|
AlertO365.exe.config
|
File
|
Contain configuration values used by the tool (XML format)
|
microsoft.exchange.servicestatus.tenantcommunications.data.dll
|
File
|
Office 365 Communications API
|
report
|
Folder
|
First Sub-Folder
Contains the HTML reports
|
images
|
Folder
|
Sub-Folder of the Report Folder
|
Logo1.png
|
File
|
First Logo in the report
|
Logo2.png
|
File
|
Second Logo in the report
|
Install and Configure
Installation
To use this tool, no special install utility is needed. Just extract/copy the package to any location on the computer/server.
In this example, the tool is extracted and placed under the C:\ drive
Image 1. Folder Structure |
Configuration
The configuration file is AlertO365.exe.config, this is in XML format and can be edited using a normal text editor like Notepad.
Fields and Values
ServiceURL – No need to change this. This is a constant value provided by Microsoft in their API documentation
DomainNames – The Tenant Domain to be checked (enter only one domain)
UserName – Username used to authenticate to the Tenant Domain
Password – Password for the Tenant Domain credential
IsAOBO – No need to change this. The function related to this value is not (yet) implemented.
PastDays – Number of days with which the tool would query events for (i.e 1 for the past 1 day)
SenderAddress – Sender address of the email report
RecipientAddress – Recipient addresses of the email report. Separate with comma (,) for multiple recipients
SMTPServer – IP address or resolvable name of the SMTP relay used for sending the email report
MailSubject – The String to be used as Message Subject and Report Title
Company – The company or domain name that will appear in the report
SendViaEmail – Yes or No indicates whether the HTML output will be sent via email or not.
Other Configuration Items
The package contains two images namely Logo1.png and Logo2.png. These images are located under “\report\images” folder. Upon creation of the report, these images will be embedded in the email representing the Client/Company we managed and HP. Before putting the tool in production use, make sure to replace the Logo1.png file with the appropriate logo image for the client/company being managed.
Sample Report
How to Use
This is a console-only application which is best executed using the command shell (or can also be double-click in explorer – not recommended).
Can also be executed by Scheduled Task if preferred to run at certain interval (Daily, Hourly, Monthly..)
This is a console-only application which is best executed using the command shell (or can also be double-click in explorer – not recommended).
Can also be executed by Scheduled Task if preferred to run at certain interval (Daily, Hourly, Monthly..)
Image 4. Sample Tool Execution
|
Download and Source Code
AlertO365 1.2 - https://github.com/junecastillote/AlertO365
Note: Download contains source code. If you want to just get the binary output and associated files listed in "Files and Folders" section above, just go to the "bin/Release" folder.
Backup All Distribution Groups and Members using PowerShell
June Castillote1:47 AMBackup, Exchange 2010, Exchange 2013, Exchange 2016, powershell, Scripts, Tools
No comments
Someone in the group – either an admin or service desk, may commit a mistake at some point and delete a distribution group or empty out the members' list. When that happens usually the recovery action is to restore a backup of the active directory. This script can be used to create brick-level backup of distribution groups, so that they can be restored individually.
Download
https://github.com/junecastillote/Export-GroupsAndMembers
Variables
Modify the variables as needed
Sample Output
Running the script
Backup File
Sample Data
Exchange Server 2010/2013 Health Check PowerShell Script (v5.4)
A re-work of my previous ExDac utility for Exchange Server 2010 which was written in .NET
Now, this is written in PowerShell instead of VB.net, and as a result, the entire script runs for half the time than the previous tool.
What the script does?
The script performs several checks on your Exchange Servers like the ones below:- Server Health (Up Time, Server Roles Services, Mail flow,...)
- Mailbox Database Status (Mounted, Backup, Size, and Space, Mailbox Count, Paths,...)
- Public Folder Database Status (Mount, Backup, Size, and Space,...)
- Database Copy Status
- Database Replication Status
- Mail Queue
- Disk Space
- Server Components (for Exchange 2013/2016)
Then an HTML report will be generated and can be sent via email if enabled in the configuration file.
I have not tested this for Exchange 2016 but in theory, this should work just as well (let me know if it doesn't).
Sample Output
Parameters
- -configFile, to specify the XML file that contain the configuration for the script.
- -enableDebug, optional switch to start a transcript output to debugLog.txt
Configuration File
The configuration file is an XML file containing the options, thresholds, mail settings, exclusion that will be used by the script. The snapshot of the configuration file is seen below:
reportOptions
This section can be toggled by changing values with "true" or "false"- RunServerHealthReport - Run test and report the Server Health status
- RunMdbReport - Mailbox Database test and report
- RunComponentReport - Server Components check (Exchange 2013/2016)
- RunPdbReport - For checking the Public Folder database(s)
- RunDAGReplicationReport - Check and test replication status
- RunQueueReport - Inspect mail queue count
- RunDiskReport - Disk space report for each server
- RunDBCopyReport - Checking the status of the Database Copies
- SendReportViaEmail - Option to send the HTML report via email
- ReportFile - File path and name of the HTML Report
thresholds
This section defines at which levels the script will report a problem for each check item
- LastFullBackup - age of full backup in days. Setting this to zero (0) will cause the script to ignore this threshold
- LastIncrementalBackup - age of incremental backup in days. Setting this to zero (0) will cause the script to ignore this threshold.
- DiskSpaceFree - percent (%) of free disk space left
- MailQueueCount - Mail transport queue threshold
- CopyQueueLenght - CopyQueueLenght threshold for the DAG replication
- ReplayQueueLenght - ReplayQueueLenght threshold
- cpuUsage – CPU usage threshold %
- ramUsage – Memory usage threshold %
mailAndReportParameters
This section specifies the mail parameters- CompanyName - the name of the organization or company that you want to appear in the banner of the report
- MailSubject - Subject of the email report
- MailServer - The SMTP Relay server
- MailSender - Mail sender address
- MailTo - Recipient address. For multiple recipients, separate the addresses with a semi-colon (;)
exclusions
This section is where the exclusion can be defined.
- IgnoreServer - List of servers to be ignored by the script. Separate with a comma (,) with no spaces.
- IgnoreDatabase - List of Mailbox Database to be ignored by the script. Separate with a comma (,) with no spaces.
- IgnorePFDatabase - List of Public Folder Database to be ignored by the script. Separate with a comma (,) with no spaces.
How to Use
Run manually using Exchange Management Shell
[PS] C:\scripts>.\Get-ExchangeHealth.ps1 -configFile .\config.xml -enableDebug
Note: This must be run within the Exchange Management Shell session. Avoid using this inside the normal PowerShell session, with the Exchange 2010 PSSnapin loaded especially for Exchange 2013 servers.
Task Scheduler
Create a task in Task Scheduler with this action:
Program/script: powershell.exe
Add arguments: -Command ".'C:\Program Files\Microsoft\Exchange Server\V15\Bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; C:\scripts\Get-ExchangeHealth.ps1 -configFile C:\scripts\Get-\config.xml"
Download
You can find the latest script and config.xml file in this GitHub repository:
Change Logs
Version 5.4 (Latest)
- Added CPU and Memory Utilization Checks
- New configuration in config.xml (ramUsage, cpuUsage, RunCPUandMemoryReport)
- Code clean-up
Version 5.3 (skipped, crappy version)
Version 5.2 (Latest)
- Several code cleanups
- Renamed RunDAGCopyReport to RunDBCopyReport (because it makes more sense to call it that)
- Removed Add-PSSnapin code because it didn't play well with Exchange 2013. Hence the need to use Exchange Management Shell.
- Added the Version and Edition of Exchange Server column in Server Health report
- Revised the Get-MailQueues function
- Added AdminDisplayVersion identification in Get-ServerHealth function
- Removed PowerShell-Remoting code from the Mail flow test
- Renamed Get-DAGCopyStatus function to Get-DatabaseCopyStatus
- Added CopyQueueLenght threshold in XMLconfig file
- Added ReplayQueueLenght threshold in XMLconfig file
- Added Server Components check (for Exchange 2013)
- Added RunComponentReport option in XML config file
- Added
section in XML config file - Added IgnoreServer,IgnoreDatabase,IgnorePFDatabase fields in XML config file
- Added counter for the number of tests, passed and failed.
- Added percentage computation for overall health
- The "Issues" table is not visible from the report if there are no actual issues detected
- Added individual test results summary
- Added logic to not run DAG checks if there are no DAGs
- Added logic to not run Mail Flow test against Mailbox Servers with no Active Mailbox Database
Version 5.1
- Added new parameter "configFile" where you will need to specify the configuration XML file which contains the variables that used to be included inside the script in previous versions.
- Moved the Variables to an outside XML file (default is config.xml) You can create different XML files with different configurations/variables if desired.
- To run: "Get-ExchangeHealth.ps1 -configFile config.XML"
- Added DAG Copy Status
- Fixed the Math for getting back up age
Version 4.4b
- Corrected version information within the script
- Added BCC and CC line within the @params variable block, but are commented out.
- Added comments to:
- [int]$t_lastincrementalbackup
- [int]$t_lastfullbackup
- Added comments to:
- $MailCC
- $MailBCC
Version 4.4
- Added Test-MailFlow Handle for Exchange 2013
- Moved Test-MailFlow Result to Server Health Status Report
- Exclude Edge Servers from Testing
- Public Folder Database Report will not run if database count is 0
Version 4.3
- Renamed script to Get-ExchangeHealth.ps1
- Added Test-MapiConnectivity
- Added Test-MailFlow
- Added Services Status
- Added DNS/Ping Test
- Added Server Up Time
- Changed Backup Threshold from Days to Hours
Version 4.0
- Added DAG Members Replication Checks
- Added Mail Queue Checks
- Added DB Activation Preference Check
- Added "Summary" Section
- Fixed HTML character recognition issues