Tuesday, 7 November 2017

How to monitor Exchange Queues?

How to monitor Exchange Queues / How to setup an Alert for Exchange Queues...


#Author : Nishant Naidu

#Technet - i-TechNinja

# https://social.technet.microsoft.com/profile/i-tech%20ninja/
#https://itechninja.blogspot.in/
#https://crazycerebro.blogspot.in
#https://social.technet.microsoft.com/wiki/contents/articles/47620.how-to-monitor-exchange-queues-how-to-setup-an-alert-for-exchange-queues.aspx

#load Snapin
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;

#Set Mailing parameters
$sendMailMessageParams = @{
    Smtpserver = " smtp server "
    To         = " To? "
    From       = " From? "
}


# HTML Body 
$head = "<style>",
        "BODY { background-color: white; }",
        "TABLE { border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse; }",
        "TH { border-width: 1px; padding: 5px; border-style: solid; border-color: black; foreground-color: black; background-color: LightBlue}",
        "TD { border-width: 1px; padding: 5px; border-style: solid; border-color: black; foreground-color: black; background-color: white}",
        "</style>" | Out-String
 #Logic to setup
if ($Queue = Get-ExchangeServer | Where { $_.isHubTransportServer -eq $true } | Get-Queue | Where-Object { $_.MessageCount -gt 200 } | Select Identity, DeliveryType, NextHopDomain, RiskLevel, MessageCount, Status, Velocity) {  $body = $Queue | ConvertTo-Html -Head $head | Out-String
#Invoke     
Send-MailMessage -Subject "Exchange Queue Alerts-Threshold 200" -Priority High -Body $body -BodyAsHtml @sendMailMessageParams
}
else{
    Send-MailMessage -Subject "Exchange Queue Alerts-Threshold 200" -Body "Queues are below Threshold limit - 200 "-BodyAsHtml @sendMailMessageParams
}

How to Use?

1. Save this file as .ps1 wherever with whatever name you want to.
2. Open Task Scheduler
3. Create a New task and set the task occurrence for this .ps1 file.

Thank You.
For any query, please comment down below.

#You can make use of BuyNow button for Donation purpose 

Saturday, 4 March 2017

Ping Multiple Servers - Powershell GUI based tool

Ping Multiple Servers - Powershell GUI based tool


The term PING stands for - Packet InterNet Groper.
Packet Internet Groper is a computer program that is used to test the network connectivity between two systems.

Most ping utilities (sometimes called ping tools) use Internet Control Message Protocol (ICMP).
  • The output of ping varies depending on the tool. Standard results include: 
  • IP address of the responding computer 
  • Length of time (in milliseconds) between sending the request and receiving the response 
  • An indication of how many network hops between the requesting and responding computers 
  • Error messages if the target computer did not respond

=====================================================================

Script Ex1 :

##Specify the list of servers.txt

$ServerName = Get-Content D:\Scripts\serverlist.txt

##### Script Starts Here ######

foreach ($Server in $ServerName)
 {
if (test-Connection -ComputerName $Server -Count 2 -Quiet ) 
{
write-Host "$Server is Online " -ForegroundColor Green
}  
    else
   {
Write-Warning "$Server seems to be offline"
    }
}
========================================================================

GUI Based Tool to PING Multiple Servers - Powershell


How to Use:

1. Enter hostname in Text-area provided. Note :- One host per line

2. Once hostname entered, click on Ping Check button.

3. Depending on Number of hostname entered output may take time.

4. If you want to erase the hostname that you entered, click on Clear text

Output:

It will generate two text files and save it at your desktop.
Pingservers.txt and NoPingResponse.txt, this text files you can find at your desktop.


Screenshots:



Download :


Thanks you guys, Please comment if you have any query.
Have a Nice Day!