Writing PowerShell scripts over the last couple of weeks has been a steep curve. I’ve watched PowerShell from afar over the years but don’t really use it enough to say I know it. Luckily, many others do, and they’ve posted their knowledge on the ‘net. This is what I drew upon:
- Don Jones: defining parameters, Glenn Sizemore: parameter validation and Boe Prox: parameter validation.
- Tobias Weltmer on PowerShell.com: validate an email address.
- Don Jones: the power of variables.
- Thomas Maurer: checking variables for null values.
- Chris Oldwood: throwing exceptions and exit codes (I need to do some work on my scripts to improve this…)
- Microsoft Scripting Guys: checking for module dependencies in PowerShell and removing loaded modules.
- Microsoft Scripting Guys: checking a string to see if it matches another one and replacing text in strings.
- Marco Shaw: writing output in PowerShell and Microsoft TechNet: display output in colour.
- Microsoft Scripting Guys: reading a CSV file (and acting on the contents).
- Jakob Gottlieb Svendsen: creating an empty array and Microsoft TechNet: even more things you can do with arrays.
- Point Beyond: CSV and array handling.
- Microsoft Scripting Guys: counting the number of elements in an array.
- Anita Boerboom: ForEach vs. ForEach-Object.
- Richard L Mueller: escaping in PowerShell and Stack Overflow: escaping dots (with
"\."
because they don’t work with-match
for string comparison).