I am a fairly new Windows Systems Administrator. I have done some basic batch files and some other scripting. I would like to know what path I should take to become a better scripter. What language should I study and what are the best resources to learn from (web sites, books and the like).
closed as primarily opinion-based by HopelessN00b Mar 1 '15 at 21:31
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
locked by HopelessN00b Mar 1 '15 at 21:31
This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.
Read more about locked posts here.
The language doesn't matter (much) - you're knocking on the door of asking to learn programming, and good programmers need to be fluent in more than one language. So, pick one and go with it. Suggestions
- KiXtart is pretty good for simple-and-Windows.
- PowerShell and VBscript are the standards on Windows.
- Install Cygwin and learn bash.
- Try Perl.
- BAT has it's place, but it's a terrible language (if that) with a lot of weird (although sometimes useful) quirks.
How to get good? Pick a project that needs doing, and do it. Are you spending a lot of time doing any manual, repeatable process? Script it. Script it in pieces, make the pieces bigger or string them together, until the whole thing is scripted.
Take a college class for Intro to Programming, or intro-or-intermediate Unix, that should have items in the course description like 'ksh' or 'bash' or 'shell'.
If you have seen much of what Microsoft is speaking of these days the choice of language is self-evident: PowerShell.
The "How do I become..." part of the question is a bit harder to answer. Without delving into the esoteric waters of information assimilation theory, you still need to figure out how you learn the best. My suggestion:
- Pick a task
- Script the task
- Figure out why the script doesn't work
- Fix the script
- Repeat steps 3 and 4 about a dozen times
- Gloat about your successes to your SysAdmin colleagues (that would be us)
I started by finding/download scripts that did something and then read through them to see how things were done. The Scripting Guy is invaluable for windows. I would also sift through the Scripting Guide on technet. it has tons of articles on writing scripts, documenting, a bazillion examples of how to do things on windows (config printers, list all accounts in AD etc.) how to write to the system log etc.
Depends on what you need to script for. I disagree with some of the assertions put forth by previous posters.
Batch is AWESOME. It's simple and MOST scripts I've had a need to write can be done with shorter code than most other scripting languages. It also has an advantage in that, with a few differences, it can be used on virtually every Microsoft operating system. It's also great because you can use just about any command line utility in your scripts so while the built in functions CAN be somewhat limiting at times, odds are, someone has a command line tool to do what you need and if you know batch scripting, you can incorporate it easily, giving you REALLY powerful stuff.
PowerShell is POWERFUL. But it's still fairly new. And while it's potentially VERY useful, it's newness means it's not necessarily something you can walk in and start using at any given client/situation.
VBScript is great and has many great features. It also adds to your skillset because VB script is similar to ASP which is similar to VBA which is similar to VB6, so in the end, if you know one of those languages, you can quickly figure out the others (in most cases).
Other scripting languages such as Perl, KiXtart, and so on have their places, but usually require additional tools/files installed. I'm a big fan of learning to do things with what comes STANDARD with the OS, so you don't get yourself stuck saying "I don't know how to do this" when you need to do something but installing something isn't an option.
As for resources, several have been mentioned and I can't complain about any of them... but I'm surprised and even disappointed two sites hasn't been mentioned - for general scripting tutorials and overviews, see www.robvanderwoude.com and for a comprehensive command line reference (especially for batch, but also for PowerShell and a few other useful things), see www.ss64.com
I would start with a mixture of VBScript and PowerShell, both of which can be learned from "The Scripting Guys."
I'd recommend the following resources:
PowerShell should be a prerequisite nowadays as a Windows SysAdmin. Make sure you get good practice with it.
Use it primarily with Exchange and Active Directory. After that you wont be just better at scripting, but you will also have significantly better skills to work with Exchange and Active Directory.
This will make you a better Windows SysAdmin and more valuable as an employee.
Any scripting language, since you use Windows, I'd say Powershell is at least relevant.
Then, there are all of the other scripting languages which you can take your pick of such as Perl, Ruby, Python, and many others..
AutoIt is the easiest, fastest way to learn scripting IMO comes with it's own CLI and has a really easy to use function reference that can handle ANYTHING you need to do in windows programatically.