how to use active perl script for monitoring windows services - windows

Has anybody written an ActivePerl script using Win32::Service?
If so, can you show me some sample code on how to call this? I know its says Win32, but would like to know if this would work also on a 64 bit machine. I'm primarily interested in checking the services status.

There's a basic example on PerlMonks that you can check out. Be sure to read the comments, as there's a code modification that improves the results of the original code.

Related

How can I gather system information via scripting?

My original question was to quickly and easily gather hardware information from a computer. I was also hoping to do this over a network, rather than sit down at each PC and run a script. Scriptomatic 2.0 was the solution to my problem.
One thing I would like to note about it: It seems to work well only under Windows XP. When I ran it on Windows 7, it did not function properly.
During my long night of trying to solve the problem myself, I came across this wonderful tool. It had a ton of sample scripts, all of which applied to my situation.
http://www.vbsedit.com/scripts/misc/wmi/scr_1343.asp
This program is free by evaluation. The evaluation will never run out however, as stated by the program. Each time you compile, it takes a second longer. However, if you open a new window the counter resets. This program was extremely helpful for someone like me who knows basic programming, but nothing about VB scripting.
Microsoft has provided a free tool called Scriptomatic 2.0 which automatically generates scripts in vbscript that allows you to get hardware and software information. You can download the tool from http://www.microsoft.com/en-in/download/details.aspx?id=12028

Write a windows script

I would like write a script to automate a certain task on windows.
I use a monitor to extend the screen of my laptop but every time I remove the plug and reconnect the monitor I have to go on to desktop properties and display settings to extend the monitor and set the resolution.
Well I assume on LINUX you can do this by using shell scripting but I am not sure how to do this in windows.
From my research on the internet I have found that BASH scripts could be used to do this task automatically.
Please guys I don't need a software to do this I would like to write the script myself so that I can learn something as well.
I have read up on bash scripting but I cant find methods to access windows components and just to let you know I am an intermediate JAVA programmer. I guess I could use JAVA as well.
I hope my questions are clear.
Thank You
Bash scripting is for *nix systems, the equivalent on windows is Batch Scripting.
Some quick googling indicates that this can be done through registry edits, but they would not take effect until the next reboot.
Other than that, it doesnt look like doing that through batch scripting is possible.
If you want to look at another programming language to do this, check out this answer

Dan Kegel's crosstool is out of date -- does anyone know of a fix?

My company does Linux embedded systems using Freescale PowerPC processors.
Some years back I wrote an internal HowTo on how to use Dan Kegel's crosstool to set up a cross compiler environment for our product. I hadn't touched it since then but I recently tried it and found it doesn't work. The scripts look for files on redhat.com's ftp server that are currently not there.
The latest cross tool script is the one I am using, version 0.43.
So before I roll up my sleeves and see if I can fix it myself, I am wondering if someone has already done this. Does anyone here know Kegel well enough to contact him and ask if he is planning to do an update? (My guess is not. He works at Google now.)
Alternatively, is there a better GNU cross tool builder than Kegel's cross tool? It might be easier to switch over than to update the old one.
As it turns out Mr. Kegel was kind enough to respond to my e-mail. It turns out his original scripts have been picked up by an open-source group that calls it crosstool-ng. They did an amazing amount of work on this and the tool now uses a curses-based menu system to select the options for the cross development to generate.
You can search for file names directly in Google (try '<filename> site:ftp.redhat.com' or something similar), and often results will yield revised links to the files. If that is the problem, it should just be a case of cut and paste. Alternately, I would recommend downloading the files locally, modifying the script to see them there and then bundling them with the script.
Kegel left Google for a startup. His resume is at http://www.kegel.com/resume.html . Have you tried emailing him? He might just respond.

Windows tail program that lets you add blank lines

On Linux, when tailing a log, I can hit enter a couple times to give me a bit of separation in the output. Makes it easy to debug or just watch for things happening.
I've tried a couple of tail programs for Windows ("Tail for Win32" and "mTail") and they cannot do that. It's a bit painful to check the timestamps to find what the last set of lines that was dumped out. Rather than conduct an exhaustive survey myself, and because I didn't find this feature addressed here, I thought I'd ask the SO collective mind. Does this behaviour exist in any program for windows?
You can try Hoo WinTail or SnakeTail, that supports the ability to make bookmarks. Maybe there are other alternatives
Try this:
Win Log Inspector
It allows also to connect to a remote file by using http or ssh protocol

Is there any free/opensource vbscript compiler?

I need to compile a wmi vbscript to executable (to automate configuration in several computers). Any free vbscript compiler or any other suggestions?
One thing I would be especially concerned about in doing this is you must really trust the product that is compiling the script. After all, what better way to embed a virus or worm than to offer a free compiler that compiles your VBScript into an unreadable executable.
Currently, the best known opensource client side vbscript is baleas2.
If you are talking about server side vb like scripting, then the option list is very big as follows: instant-asp (ib4j-tomcat, java), rbsp (realbasic-server-pages), pbsp (purebasic-server-pages), run-basic (libertybasicscript), and so on with almost all the completely developed commercial alternatives to vb.
Regarding other windows based opensource basic variant in the area of basicwebscripting currently are maven-sb4j, scriptbasic and gbs3 (gambas server pages). Then freebasic server pages may soon be yet another option in the future (after development for curl and proxyserver / fastcgi support).
You may also try using maven-sb4j for jbasic, jabaco, scriptbasic-japi and yabasic-japi.
Try http://www.xneat.com/application-builder/index.htm
looks trusted
ok that's interesting i guess, and I fully understand your point!
you can use the WSH Encoder here (Windows Script Host), it's for free you can encrypt your scripts and this way no one can read them (just the not curious ones!)
and if you are looking for some strong and hard work also encryption you can try this book here
Try vbs to exe. It's command line but works fine.
http://www.f2ko.de/programs.php?lang=en&pid=v2e

Resources