The new job I have is looking like it will involve a fair degree of fairly low level system administration, we have a lot of instances of the same stuff with different customisations for different clients. In order to make life easy I'm looking to automate as much of this as I can and over the past few days have found myself back in the world of batch scripting. Now this is on Windows systems and it is becoming very clear that old .bat files and checking error levels etc is just not going to cut it. Yesterday I spent a bit of time having a play with VB Script / WSH and having a good read up on Windows Power Shell. I have to say the power bit of power shell really does appeal, it might be MS but I have to say I was seriously impressed with it. The ability to query via inbuilt methods and export in a number of formats could be VERY handy.
The issue / question is this. I'm lazy, I'd like to learn one scripting language well and then use it in not just Windows but also Unix / Linux environments. I know I can plug plug a Perl module into WSH to allow me to script in Perl (something I've been running away from for a while as I find Perl an UGLY language!), likewise with Python. Trouble here is that they are non standard configurations so I could never deploy them at customers and none of my co-workers would be in a position to maintain them, likewise with Power Shell. VB Script would work well on Windows but then I'm screwed on the Linux side. This leaves Java Script... Can you script on Linux in Java script? I'm not talking web development here but system administration tasks, the sort of stuff you might do with a BASH script or a bit of perl.
Any other suggestions on how to approach this? I guess the real answer would be to learn the right tools for each platform but if I can reduce the learning curve and re-use bits of logic then that would be cool.
Not an option really, the main focus is on Windows and it will have to run on user PC's (internal customers). It HAS to be part of the standard distro and there is no way I'd get Cygwin under the radar. I might be able to get the Perl snap-in past the powers that be, but then I'd have to deploy that on users PC's for them to be able to invoke scripts locally. Might as well be VB Script for that side of things
Seriously though - I just can not stand the look of Perl. I know it's bloody powerful but I just can't live with the hideous code and obscure string sequences. For the stuff that I will be running from my system I'm actually wondering if Power Shell might not be the answer. I'd strongly recommend that you take a look at it, I'm a cynic and I was blown away after reading a couple of papers... I know, I know... I'll say my hail Linus's later.
As for Java Script you can do pretty much everything you would with VB Script under windows. As I said it's rather confusing as you (like me!) instantly thought in terms of web page scripts - it's a totally different beast. Again worth a look, think VB Script meats Java and the WMI / COM interfaces. Hooks into just about every last part of the system.