The Surly Admin

Father, husband, IT Pro, cancer survivor

Discovery with Powershell – Script to Get Screenshots for VMs

In the IT world, Administrators love to debate which technology is better.  Mac vs. PC, Android vs iOS, you name it we’ve argued over it.  One that I’ve been seeing a lot of over the last few years is vbScript vs Powershell.  As you probably know, I stayed in the vbScript world for quite a while because it was a safe, known haven that suited me.  But then I came to Powershell, and learned how you can discover what’s going on in Powershell so easily.  This started with using a great Integrated Scripting Environment (ISE) like PowerGUI or PowerShellPlus, but then I discovered a few other commands that helped me discover information about the objects I was working with.  Specifically Get-Member.  Read on to see how I recently used Get-Member to solve a problem.

Continue reading

Advertisement

January 31, 2013 Posted by | PowerShell | , , , | 2 Comments

The Surly Lab

One problem I’ve had for a while now is the lack of a good testing lab.  I’ve had a pretty nice server downstairs in the basement, and it was running VMware vSphere 4.1 with a couple of servers on it but then one day awhile back I decided to upgrade from a 2003 infrastructure to one based on 2008 R2 and that’s when things started to go bad.

Continue reading

January 28, 2013 Posted by | Technical | , , , , | Leave a comment

Functions That Use the Pipeline

Earlier this week I talked about creating HTML reports from within Powershell, using the ConvertTo-HTML cmdlet.  One of the technique’s I used was a custom function I wrote called Set-AlternatingRows which took the table created by ConvertTo-HTML and alternated the row colors.  This was a great exercise in using Functions and the Pipeline and I wanted to talk about that today.

Continue reading

January 24, 2013 Posted by | PowerShell | , , | 7 Comments

How to Create HTML Reports

Find yourself creating reports in Powershell and wished they looked a little more presentable than a CSV file?  Send regular reports to your manager and want it to look professional?  Here are some technique’s I’ve developed that produce some pretty sharp reports in HTML using standard Powershell cmdlets (plus one function to pretty up your tables).

Continue reading

January 21, 2013 Posted by | PowerShell - HTML Reporting | , , , | 10 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

Building PSObject Performance

You know I love working with Objects in Powershell, but are some methods better at building them then others?  Ran into an interesting technique recently and wanted to test it against my normal way of doing things.  Read on to see which technique is faster

Continue reading

January 14, 2013 Posted by | Powershell - Performance | , , | 6 Comments

To Redirect or Not

Recently I was working with someone on Spiceworks and he kept insisting on using redirection to fill a log file.  This seemed messy with me, so I decided to test his code versus what I like to do.  Read on to see the results.

Continue reading

January 10, 2013 Posted by | Powershell - Performance | , | 1 Comment

Remove Empty Directories Recursively

An interesting problem came up at Spiceworks the other week, and it was all about deleting empty directories.  Locating empty folders and removing them is actually pretty easy but the complication comes when you have nested folders, all of which are empty.  The most obvious scripting method doesn’t work in that regard.  Let’s see how I accomplished this task.

Continue reading

January 7, 2013 Posted by | PowerShell, Powershell - Performance | , , , , , , | 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

Random Thoughts – Spiceworks, WordPress and more

Couple of random thoughts I wanted to write about on Spiceworks, WordPress and Powershell.org

Continue reading

January 2, 2013 Posted by | Random Thoughts | , , | Leave a comment