Mafutrct has provided a very good response; if you are starting windows scripting then you should definitely begin with with PowerShell. The built-in commands, PowerShell extensions and the ability to use the .NET runtime ensure that all your scripting requirements are met. I only wish for a better scripting language in PowerShell. If only it were Javascript :(.
I want to point out that WSH remains a viable scripting environment for windows. The reasons why I continue to use it are:
- Javascript, being both functional and prototypal, allows complex scripts to be written simply and easily
- Throw in WMI and almost everything windows related can be accomplished very easily. This is very useful for networking and system administration related tasks
- WSH scripts can be run with equal convenience on both window and console (i.e. invocation by wscript and csript)
- Writing a script is as easy as opening notepad, typing the script, saving it as a js (or .vbs, .wsh) file and double clicking the saved file
- Although it no longer remains strictly a script, a .js file can be complied for the CLR using the .NET’s Javascript compiler: jsc.exe. Like PowerShell, this provides access to the entire .NET framework
Some of the scripts that I wrote in the last few weeks were:
- Pulling data from MS SQL server, creating an Excel sheet and pushing the data into it, and mailing it to a client
- Formatting, parsing and filtering thousands of lines of VOIP switch log files and vector scripts
- Using Ajax to pull data from a remote server, calling a web-service and passing the data to it
- I spook my co-workers when they use my laptop by remotely “speaking” to them via the speakers with a script using Microsoft’s Speech API. Here’s the sample code:
var sapi = new ActiveXObject("SAPI.SpVoice");
sapi.speak(“hello world”);