Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Powershell Script help

Posted on 2013-01-21
4
Medium Priority
?
465 Views
Last Modified: 2013-02-06
Hi Guys

Im new to this community hello everyone

I need a small favor with a script

Is it possible to modify the following script to monitor Critical services on AD and exchange
I Put this together to monitor the dropbox process on a file server some time back

$ProcessActive=[bool](Get-Process Dropbox -ea "silentlycontinue")

      if($ProcessActive)
      {
            Stop-Process -processname Dropbox
            Out-File -filepath "D:\DropBox-Conflicted Copy logs\process_Logfile.txt" -InputObject "process is Running - Process terminated" -force
                        
                  $body = "DropBox - No conflicted files"

                  Send-MailMessage -SmtpServer EXCH01 -From admin@blahblah.com -To alerts@blahblah.co.uk -Subject 'DropBox Process Status' -Body $body

      }else
      {
            Out-File -filepath "D:\DropBox-Conflicted Copy logs\process_Logfile.txt" -InputObject "process is not Running - No action required" -force
                        
                  $body = "process is not Running - No action required"
                  Send-MailMessage -SmtpServer EXCH01 -From admin@blahblah.com -To alerts@blahblah.co.uk -Subject 'DropBox Process Status' -Body $body
      }
0
Comment
Question by:Rat Zulu
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 1200 total points
ID: 38800667
Checkout this script from TechNet Script Gallery and see if it works for you..
Exchange Server 2010 Services Monitor - HTML Report
http://gallery.technet.microsoft.com/office/0cd74cb6-3924-45b0-944b-a86441401094
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 38800725
BTW, it is much more convenient to "simplify" your code, putting the same code parts together:
$ProcessActive=[bool](Get-Process Dropbox -ea "silentlycontinue")
if($ProcessActive) 
{
  Stop-Process -processname Dropbox
  $body = "DropBox - No conflicted files"
} else {
  $body = "process is not Running - No action required"
}
Out-File -filepath "D:\DropBox-Conflicted Copy logs\process_Logfile.txt" -InputObject $body  -force
Send-MailMessage -SmtpServer EXCH01 -From admin@blahblah.com -To alerts@blahblah.co.uk -Subject 'DropBox Process Status' -Body $body

Open in new window

0
 

Author Comment

by:Rat Zulu
ID: 38801558
Thanks for the tip Qlemo

Subsun Thanks for the response im checking the script
0
 

Author Closing Comment

by:Rat Zulu
ID: 38858572
Thank you very much
0

Featured Post

Ready for your healthcare security check-up?

In the past few years, healthcare organizations have become a prime target for advanced attacks. Does your organization have what it needs to defend itself? Schedule your healthcare security check-up today and download our free Healthcare Security Resource Kit today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question