Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Thursday, March 14, 2013

Windows Service Monitor and starting

Hi friends,

It's been long since my last post. Again I am here with some solution. Specifically for windows. The problem statement was, few windows service was getting stopped all of a sudden due to some error. What we needed is one small utility which monitors the specific service and start that if that is stopped.

There was many suggestion and solution, many monitoring softwares. But I liked the solution mentioned below. Took quite some time to collect all the information and build it.

First copy paste the below code in a file named as "serviceMonitor.vbs" or you can choose any other name as well.


Set sh = CreateObject("Shell.Application")
set shellLogger = CreateObject("WScript.Shell")

If sh.IsServiceRunning("SERVICE_TO_MONITOR") Then
    shellLogger.LogEvent 4, "
SERVICE_TO_MONITOR is running"
Else
    shellLogger.LogEvent 4, "
SERVICE_TO_MONITOR is not running"
    if sh.ServiceStart("
SERVICE_TO_MONITOR", true) Then
        shellLogger.LogEvent 4, "
SERVICE_TO_MONITOR automatically started"
    Else
        shellLogger.LogEvent 4, "
SERVICE_TO_MONITOR could not be started"
    End If
End If   

Replace the word SERVICE_TO_MONITOR with name of your service.
Then open scheduler and create a task. Choose the trigger you want, I kept it at every 1 min.

wolla...  your windows service will never be down. If it is down, It will be up within next one min. :)

Sunday, September 25, 2011

Start command prompt from context menu in windows

Hi folks,

Again another techie blog.

 This is to solve a simple problem we all face quite often in our daily life. Mainly QA person and developers face this. For getting Command prompt from any opened folder we have to open command prompt then copy the path then paste and ...... long process... Huh..

So here is a simple solution, copy the following text in a .reg file and save that. Now run it once, In some secured system it may ask for admin rights, as it will update the registry. But no worry, just allow it. After that on any right click of any folder will give u an option to open command prompt from there.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\startCmd]
@="Start Command Prompt From Here"
"@author"="Aniruddha Dutta Chowdhury"

[HKEY_CLASSES_ROOT\Directory\shell\startCmd\command]
@="cmd /k pushd \"%1\""