Year: 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 …

VBScript Progress Bar

Someone, I never met or spoke to, sent a personal note asking me if I can help them in figuring out how to write a progress bar in VBScript. I am not completely sure what he wanted when asking about progress bar. Progress of any task can be measured in many different ways. It all depends what is that task doing at any point in time. You can calculate % complete based on the disk read/writes or based on the threads it had spawned and the estimated time to complete all these threads. These kind of calculations vary a lot from system to system and CPU to CPU. I have no clue about such an algorithm. When I read his mail, I assumed that, he wants to copy some files from one location to another location and wants to measure the progress of this operation. So, I just wrote small script to illustrate what he wanted. ‘Script Start Dim intFCount, FSO, strSrcFolder, strDestFolder, strSource, FC, i, intPercentComplete i = 0 intFCount = 0 intPercentComplete = …

Out of Hibernation

It has been a while since I wrote something here. It is not because I dont have anything to write but just because I got busy with many other things in personal and professional life. I just got back to the routine after my marriage with Silpa. Also, I have taken up new responsibilities at work. This is just keeping me busy and I just forgot my personal space for a while. While I was away, I did some work on my Open Source project. I had completed couple of modules related to error logging and reporting. I haven’t had a chance a put this on SF yet and I don’t want to do it until I have a real “working” code. I will call that Alpha version and release it to the community. Apart from my professional and personal interests, I have been helping some folks on VB Scripting and WMI. I will share all those details here. I hope to continue writing here without anymore “Long” pauses