Saturday, March 26, 2016

IIS SMTP Server Status Check [PowerShell]

This script can be used to check and report the status of the Smtp Service and the Virtual SMTP Server created in IIS. For use with Windows 2008+


Sample Report Output




----------------------------

Download 
You can download the script from here:


  • Version 1.1 (GitHub)
    • Removed Local Queue Counter
    • Removed Remote Queue Counter
    • Added Queue, Pickup, Drop and BadMail counter
    • Fixed some formatting issues
    • Replaced CSS Color theme (if you prefer the old theme, just copy the $css_string variable from the older version.
    • Some code optimization
  • Version 1.0 (GitHub)
    • Initial version

To run, no parameters required, just execute the script from PowerShell.

The Variables
Make sure to edit the following variables to conform with your environment or requirements





Monday, September 7, 2015

[TOOL] IMCEAEX to X500 Converter

Tool to convert IMCEAEX String (from NDR) to valid X500 String.

Link:
http://1drv.ms/1UBDJC8

Screenshot:


Friday, June 26, 2015

Office 365 Service Health Check [.NET]

Tool Overview


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.

Image 2. AlertO365.exe.config contents


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 – The Tenant Domain Administrator account used for authentication

Password – Password for the Tenant Domain Administrator account

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


Image 3. Sample HTML Report via Email


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..)


Image 4. Sample Tool Execution



Download and Source Code











Saturday, April 11, 2015

Export All Distribution Groups and Members [PowerShell]

We all make mistakes, eventually...

Someone in the group may screw up at some point and delete a distribution group or empty out the members list - accidentally. I created this script so I can take a brick-level backup of the distribution groups which can be used for restoring missing/corrupted groups; or for use with reporting.

What the script does?

- Build List of Existing Distribution Groups and All Members
- Export to CSV
- Put CSV to ZIP
- Delete Original CSV
- Send Email Notification

Sample Output

Script Execution




Zip file is created in the specified backup directory






Which you can copy to a spreadsheet if you like








Download

You can download the script from here - Export-GroupsAndMembers.ps1

The Variables

Make sure to edit the following variables according to your environment or requirements


 

Thursday, March 26, 2015

Exchange Server 2010/2013 Health Check Script [PowerShell]


[UPDATE Mar-19-2016]
Since moving this project to GitHub (4.3), the script has been renamed to Get-ExchangeHealth.ps1

This is a re-work of my previous ExDac utility for Exchange Server 2010.
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 version.


Sample Report Output






Download 
You can download the script from here:

  • Version 4.4b (GitHub)
    • 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

To run, no parameters required, just execute the script from PowerShell.

The Variables
Make sure to edit the following variables to conform with your environment or requirements






Tuesday, August 6, 2013

Exchange Information Store Backup with Cleanup and Email Report

  1. What is MSExchangeISBackup.exe Tool?
This is a customizable program for Exchange Information Store backup purposes.
The tool is only suitable for backup to file operation. (For Exchange 2003)

This program, when executed, calls the native backup capability of the NTBackup utility in Windows to execute a backup task for the Exchange Server Information Store. Additionally, after the backup task is complete, it reads the logs to determine whether the backup was successful or not. Then it performs a purge operation of older backup file based on the retention days specified in the configuration file. A report is also sent to the intended recipients via email. These features eliminate the need to check for completion or successful backup manually; and take care of housekeeping of old backup files based on retention value.

This can also be set as Scheduled Task to run daily or whenever is required.

  1. What are the system requirements?
·         .Net Framework 2.0
·         Windows 2003
·         Exchange 2003

  1. What are the required user permissions?
·         Access to the location/drive/path where the backup files will be saved.
·         The tool is expected to be handled, used and configured by the Administrators.

  1. Where can I get the program?

  1. Installation/Configuration

·         Download and Extract the zip to any folder. In this example, it is saved in C:\MSExchangeISBackup\



·         Create the Backup Selection File using NTBackup.exe
o    Click Start > Run > NTBackup.exe
o    Select the Server and Information Store for backup.


o     Click Job > Save Selection As


o    Save the BKS file. In this example, it is saved in C:\MSExchangeISBackup\DevSvr01-IS.bks


o    Modify the INI file. In this example, we are configuring the config.ini file.

[OPTIONS]

;the path for NTBACKUP.exe
NTBUPathName=C:\Windows\System32\ntbackup.exe

;the folder where the Backup Selection is located. (*.BKS)
BKSDir=C:\MSEXchangeISBackup\

;the filename of the backup selection file
BKSFile=DevSvr01-IS.bks

;the path where the backup file will be saved (*.BKF)
;this coud be a local drive or a network location.
;TAPE is not supported.. yet.
BKFDir=C:\Backup\

;Prefix for the backup filename.
BKFPrefix=DevSvr01_

;File extension for the output backup file. There is usually no need to change this.
BKFExtension=bkf

;How many days to keep the copy of the backup file in the BKFDir location before it is purged.
;Make sure that a MINUS sign comes before the number (eg. -14 for 14 days retention)
KeepDays=-5

;Indicate if backups older than the KeepDays value is purged/deleted. (TRUE or FALSE)
PurgeOld=TRUE

;Indicate if the report is to be sent via email. (TRUE or FALSE)
SendReport=TRUE

;IP or Resolvable name of the SMTP server where the email report will be relayed for delivery.
SMTPServer=192.168.56.250

;SMTP port. Usually 25.
Port=25

;Sender address to reflect as the sender of the report.
Sender=DevSvr01_Backup@labworks.local

;Recipient addresses of the email report. Seperate multiple addresses with COMMA.
Recipient=administrator@labworks.local


  1. Run the program to Backup Exchange Information Store
·         Open Command Prompt and change the path to where the tool is saved. In this example it is in C:\MSExchangeISBackup



·         Issue the command in this format “MSExchangeISBackup.exe [INI File]” .
·         In this example, it is MSExchangeISBackup.exe Config.ini



·         NTBackup.exe will run in the background.
·         The output will be written in the command console.



·         It checks if backup was successful.
·         It will delete older backups based on the retention days specifies in the INI file.
·         The report will be sent via email if it is enabled in the INI.