[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

I need a script written to restart MSExchangeMGMT service if it stops...

Posted on 2009-05-07
2
Medium Priority
?
319 Views
Last Modified: 2012-05-06
Hello all!
I am wondering if any of you out in techland can give me acces to a sample script to restart a service if it fails. I am using a managed server system that allows me to use scripts if certain issues arise. The script is basically as follows;

Step one - Check to see if the MSExchangeMGMT service is running.

Step two - If it is running do nothing, if it ISNT running then step three

Step Three - Restart the MSExchangeMGMT service.

The problem is for some reasion this service keeps stopping and I have to manually start it. Not sure what the cause for the stoppage is, no alerts, event log entries, etc; however it does just restart without issues until the next time it stops.

Any help would be greatly appreciated...I will keep scouring the knowledge base!!
0
Comment
Question by:jhalscott
[X]
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
2 Comments
 
LVL 12

Accepted Solution

by:
zoofan earned 750 total points
ID: 24329554
Copy and paste code into notepad

edit line 7 to correct computer name

save as filename.vbs  execute it



zf
    Option Explicit
    Dim strComputer
    Dim objWMIService
    Dim colServiceList
    Dim objService
            
    strComputer = "."
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
        Set colServiceList = objWMIService.ExecQuery ("Select * from Win32_Service where Name = 'MSExchangeMGMT'")
        For Each objService In colServiceList
            If objService.State <> "Running" Then
            	objService.StartService()
            End If
        Next
        WScript.Quit(0)

Open in new window

0
 
LVL 12

Assisted Solution

by:zoofan
zoofan earned 750 total points
ID: 24329573
You should also check the recover options under the service properties and make sure its set to restart itself. And clear the fail count.


zf
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

656 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