The Surly Admin

Father, husband, IT Pro, cancer survivor

Transcript Logging – Why you should do it

I’d been writing PowerShell scripts for a couple of years before I came to athena health, and had a pretty good feel for how I liked to do things.  I knew about Transcript logging, but it was so inelegant.  Most of the time it didn’t capture much anyway because I really do believe in running clean scripts.  A good script shouldn’t have any problems, just run and not really return any feedback.  Especially if it’s running as a scheduled task–no one’s there to read it anyway!  And that’s the rub, if you’re not there to see what went wrong, how do you troubleshoot it?  Logging, of course!

Continue reading


October 20, 2015 Posted by | Powershell - Best Practices | | 2 Comments

Objects and Hashtables

I expect, if you got the right group of people together, you could have a good old Mac vs PC style argument over the use of Powershell Objects (PSObjects) and hashtables.  And I’ll be honest, while I’ve used hashtables a lot for splatting I’ve used them very little for anything else.  Time to look at the two and figure out which is better, once and for all!

Continue reading

February 21, 2013 Posted by | Powershell - Best Practices, Powershell - Performance | , , , | 4 Comments

Usings Verbs and Nouns

There are a lot of Administrators writing Powershell scripts out there.  A lot!  And more people dip their toes into the waters every year, including yours truly.  Did you know that Powershell even has best practices on naming your scripts?  Here are my thoughts on it.

Continue reading

January 17, 2013 Posted by | Powershell - Best Practices | , , | Leave a comment

Functions – When and how?

Recently I was reworking a script for someone at Spiceworks, you can read about it here.  But some interesting things came up and I wanted to talk about it here.  It’s about functions, and when and how you should use them.  Read on to hear my take on the subject.

Continue reading

January 3, 2013 Posted by | Powershell - Best Practices | , | 3 Comments

Powershell Best Practices – Surly Style

I have to be honest, I’m a bit of a perfectionist.  I like things neat and tidy, and I have to be honest, I see a lot of Powershell code being posted on the Intrawebs that drives me crazy.  I’ve kept my peace, my mouth has been shut and I let things slide. I have.  I haven’t said, wtf are you thinking?  How the hell is anyone supposed to know what this is doing?  I sure as hell ain’t gonna run it to see what happens!  But no more.  Time to put down here a couple of things I do in Powershell to try to make my code a little easier to access for the average admin.  Clearly you should be doing it too.  Surly Style.

Continue reading

December 31, 2012 Posted by | Powershell - Best Practices, Powershell - Getting Started | , , , | 2 Comments

Comments and what you can do with them

One of the lesser documented things that Powershell can do is the special commands available in comments.  Normally a comment is just that, something to help document your script and move on.  But with Powershell we have a couple of extra things you can do too.  Read on!

Continue reading

December 17, 2012 Posted by | Powershell - Best Practices | , , | 3 Comments