The Surly Admin

Father, husband, IT Pro, cancer survivor

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

User Termination Automation – Part 1

Having written about New User Automation here and here, it only made sense to start working on User Termination Automation.  Read on to see how I accomplished this.

Continue reading

December 27, 2012 Posted by | PowerShell | , , | Leave a comment

Merry Christmas!

Hope you holiday is filled with cheer!  For my International readers (all 4 of you) I hope your holiday season, and whatever holiday you celebrate is the best one yet.

And here’s a little script from Joel Bennett that hopefully puts a smile on your face:


December 25, 2012 Posted by | General | , | Leave a comment

DFS Replication Monitor With History Upgrade 2.6

By far my most popular post is the DFS Replication Monitor With History script, so I like to revisit it every now and then and make sure I’m doing things the best way I know how.  Continue on to see about the new upgrade.

Continue reading

December 20, 2012 Posted by | PowerShell | , , | 10 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

New User Automation – Part 2

In Part 1 of New User Automation we looked at creating the user account in Active Directory, copying all of the properties we needed and adding the new user to all of the proper groups.  Now we need to create the home directory, set the permissions and finally update the Spiceworks ticket with the information we created.

Continue reading

December 13, 2012 Posted by | PowerShell | , , , , , | 2 Comments

New User Automation – Part 1

I think just about every Windows Administrator takes a look at new user automation, and frankly in Windows 2003 rarely did more then look.  With the “Copy” feature in Active Directory Users and Computers (ADUC) and the Exchange 2003 plug-ins to ADUC you could pretty much do everything you wanted from one Window.  But with Exchange 2007 Microsoft decided to “improve” things and make the process 2 steps instead of one.  Suddenly doing things in scripting started making a lot more sense.  Here’s my take on it.

Continue reading

December 10, 2012 Posted by | PowerShell | , , | 3 Comments

Using Spiceworks Forums

Wanted to do a light, non-Powershell post today about the Spiceworks forums.

Continue reading

December 6, 2012 Posted by | General | | Leave a comment

ForEach Performance

It’s been a tough couple of weeks, let me tell you!  I had a cold, that eventually dropped into my lungs and became pneumonia.  I don’t know about you, but I don’t have much interest in doing anything when I’m sick, not even Powershell!  Also, at work, we’re ramping up to migrate from our current ERP system to one from SAP and I expect that will be eating up a ton of time too.  Not to mention the need to finish my Exchange 2010 migration, create a Sharepoint 2010 test environment from our production one and half a dozen other projects going on at the same time.  I hope to keep fitting my scripts in amongst all this, as I have to admit this is where my IT passion is right now.

Continue reading

December 3, 2012 Posted by | Powershell - Performance, Random Thoughts | , , | 2 Comments