Month: May 2007

Running script as a Windows Service

I have a small WMI script which provides information about Removable storage as and when they are plugged in or removed. I always thought that it would be good if I can run this script as a service in the background so I don’t have to start the script myself every time I reboot or keep it in my startup group or dedicate a command prompt window to run the script. I came across a small tool, which used to be part of Windows Resource Kit tools, which is a part of Windows XP now. It is called SC.exe. This tool is a multi purpose tool which can be used to manage services under Windows. This has a very nice feature of creating user defined services. In the above command, binpath is used to specify the path to your script. Since VBS cannot run on its own, we require an engine to initiate the script. You can use either cscript or wscript. Type= interact option would make this service an interactive one. This would mean …