To be frank, I am kind of a beginner when it comes to PowerShell or scripting in general, I was working for really small businesses for some time and I didn’t really bother scripting. There were simply not too many repeating tasks and so I went and did most everything manually.
So obviously things have changed, for starters I’m not working for said small businesses any more. There are now a lot of tasks that would take hours to be completed manually. And there is this shiny, new toy out there, called Windows PowerShell. Ok, it’s not really new, but a lot of people still stick to there old tools as they knew how they worked for years, so why change something that got the job done in the past? Well, here are my key points:
Automation prevents errors
This is the most important point for me, think about some task where you have to repeat a configuration change for like 8 times. It’s not that scripting or automating is that much faster than making the change manually, that would be the case if it were 100 times or more, but 8, come on. The one key thing is, that by using automation the configuration is exactly the same every single time you have to do it. Sure, you have to spend a little more time in planning your steps (instead of just clicking your way through), you have to write a few lines of script, or just chain together some commands. Once your little tool is complete and tested, you can use it over and over again, it will produce the same result every time you run it. So we are getting to my second point.
Create reusable tools
PowerShell enables you to create reusable tools very easily, if you are typing some commands into the command line interface, the exactly same commands can be saved to a ps1 file and executed by a co-worker, a scheduled task or... you get the point. The first point still applies here, if you create a tool and share it with your colleagues or co-workers not only are you simplifying certain tasks, you are again eliminating a common source of error.
The transcript feature simply writes anything you type and all output of the current command line window to a file, this file can easily be used to document configuration changes.
So where do I start? First of all, remember one key command: Get-Help. It’s simple, it comes with PowerShell and the help content is very, very well written! Try this: ‘Get-Command | Get-Random | Get-Help –Full’
A good place to start is the Windows PowerShell Survival Guide on the TechNet Wiki.
There are some good books on the topic available, I’m looking forward to PowerShell in Depth by three of the most well-known PowerShell gurus: Don Jones, Richard Siddaway, and Jeffery Hicks.