Powershell Script help

Posted on 2013-01-21
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")

            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 -To -Subject 'DropBox Process Status' -Body $body

            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 -To -Subject 'DropBox Process Status' -Body $body
Question by:Rat Zulu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 40

Accepted Solution

Subsun earned 400 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
LVL 70

Expert Comment

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")
  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 -To -Subject 'DropBox Process Status' -Body $body

Open in new window


Author Comment

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

Subsun Thanks for the response im checking the script

Author Closing Comment

by:Rat Zulu
ID: 38858572
Thank you very much

Featured Post

Ready to trade in that old firewall?

Whether you need to trade-up to a shiny new Firebox or just ready to upgrade from whatever appliance you're using now, WatchGuard has the right appliance for you! Find your perfect Firebox today with appliance sizing tool!

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Check out this step-by-step guide for using the newly updated Experts Exchange mobile app—released on May 30.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses
Course of the Month4 days, 7 hours left to enroll

635 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