I’ve been writing scripts in one shape or form for over 20 years now. During this time I’ve written scripts in batch, AutoIT, AutoHotkey, SQL, PHP, ASP, VBscript and PowerShell. I love automation and typically take hold of whatever scripting language I need to use.
If anything, writing literally thousands of scripts to do all kinds of crap has taught me that the hard part is not getting the script to do what you want it to do; it’s figuring out what you want to do in the first place!
When faced with learning a new programming/scripting language I found the core methodology to be all very similar. Every modern OOP language has variables, constructs, objects, properties, methods, etc. You can always loop over a container of items whether you call the container a collection, an array, a hash table, an associative array, an array list…whatever. You get the point. At their root, they all give you similar tools to solve a particular problem.
Let’s keep this conversation related to PowerShell.
If you’re new to PowerShell or scripting in general and chose to use PowerShell to solve a particular problem don’t be scared of PowerShell itself. If you get stuck on that particular loop or what data type to assign to that variable when it does that thing Google is at your fingertips.
You have adamtheautomator.com and thousands of other resources at your disposal that you can call on to quickly diagnose the problem. IMO, you needn’t focus on how to write the Powershell script, you need to focus more on what to script. Let me give you a couple of examples.
You need to query a SQL server? Not a problem! The Powershell code has already been written into a nice module called SQL PSX. Download it, import it and do it. You’ve got the capability now to query SQL but where’s the data stored you want?
”I see 500 tables and views, where was the data stored again?”
”Damn, it looks like I’m going to have to figure out how to do a few JOINs…”
Before you know it, you’re cracking open a copy of SQL For Dummies. The what is a whole lot more complicated than the how.
Do you need to perform a WMI query? Not a problem! One line with Get-WmiObject or
Get-CIMInstance and you're…