Skip to Content

Blogs

On PowerShell Adoption

A recent post by Andy Schneider on his blog is along the lines I am currently thinking of, getting administrators (co-workers) to adopt PowerShell. Co-worker adoption of PowerShell is high on my list of work hobbies that I see as beneficial to my environment and myself.

I am a Systems Engineer/Admin in my day job. I both implement systems and admin them. More people learning and being familiar with Microsoft' next generation tool set means more people able to help me when I get stuck on something myself.

Years ago I used batch scripts to make my job easier and automate various tasks. Microsoft came along and decided that the language of the future was going to be vbScript. Now, vbScript is a programmers dream. It is arcane and difficult and has a steep learning curve. I figured out basic vbScript from Microsoft's scripting guys site and some books (there are some very basic examples on my site) but you have to be determined and recognize that there is value in learning how to automate various tasks. I got things accomplished with it, but it never 'clicked' with me as it did with some. To my mind, the emphasis of vbScript and the de-emphasis of batch scripting created a gap in the IT generations. As new admins come up through the ranks and join the IT profession, they turned to compiled tools or 'resident scripting expert' instead of learning to script themselves.

In addition, though PowerShell has been out for two years, it's only in the last year that it's become obvious and publicized that it is the shell language for Microsoft going forward.

So let's add to Andy's post

Find all distribution lists specific people manage

I mentioned to a friend of mine a script I was working on. I had almost had it working, though slow and clunky, when he IM'd me his solution. His solution is good for one user, but I needed to find out for multiple people.

I modified his somewhat (as his was a _cough_ bit faster then mine) so it would only hit Active Directory once and output the results to an object (I need to really understand this better and I want to use it later in a larger script to output to Excel).

PowerShell Plus v2

I was invited to check out a preview version of PowerShell Plus v2 last week. I have been using an earlier version since at least April and it has consistently impressed me with it's features and usability.

It's gotten even better. The installer is slick, it pops up the 'Learning Center' on the first install. The learning center has a nice overview of PowerShell and PowerShell Plus in one convenient location. It also has what seems to be a live updated cmdlet help. Any of the cmdlet help texts from any of the loaded snap ins in your profile are available right there. When you look up a cmdlets help text through there it's format is Name -> Synopsis -> Requirements -> Examples then the Details. When I look up the help file, I am most often looking for the examples so that's a clear win there.

I should mention that I am an admin script writer rather then a developer. I write scripts to help make my job easier rather then writing code for fun. PowerShell Plus has more tools then I currently need, but it works really well and some of those advanced tools (the debugger in the editor) have really made my life easier. As I spend more time scripting with PowerShell, I expect to learn to leverage those provided, unobtrusive tools better.

What surprised me most was that the partnership was with Idera. Idera always struck me as a SQL tools shop (good tools from what the SQL folks say), but with Microsoft going with PowerShell everywhere I guess it makes sense.

Sign up to check it out here. It does get you in their contacts database, but I've been in there for years and it's only one 'touch base' style call a year from some very polite sales people.

Dr Horrible's sing along blog

So, I will start this out with a disclaimer, I am flat out a fan of Josh Whedon's work. Buffy the Vampire Slayer was an incredibly rich story line with complex plots and actions with consequences that came in later episodes. Firefly was all to short lived and Angel was fun.

My lovely wife came home and said I have to listen to this site she found, Dr. Horrible's Sing-along Blog. It sounded silly so of course, I put it off. I finally pulled up the site... hey, Mutant Enemy Productions, Nathan Fillion, Felicia Day, Patrick Neal Harris, what!

If you haven't heard of it, go listen. It's about 40ish minutes of fun entertainment.

PowerShell while

From my previous post, I have a nice simple menu figured out and working and that was making my co-worker happy (Happy co-workers more likely to do favors so is a good thing). Our internal patch window for one of our VMware environments was coming up and my co-worker checked on the connected CD-Rom drives from the command line script I found for him so all the guest systems would vmotion properly. Watching over the shoulder I thought I could do a better job of that now.

Two goals.

  1. A menu to determine which of our environments to authenticate against (we have 5).
  2. Offer options to list or disconnect CD-Rom drives without exiting the script.
  3. Happy co-worker

... OK, that's three.

The menu I covered in my previous post with an improvement suggested by Jaykul in the comments.

To go with goal 2, I had a vague memory of 'do .. while'. A quick Get-Help about_ and I see about_while so Get-Help about_while gets me the nice little example I can use to wrap my code in.

PowerShell: A simple menu

Playing with PowerShell and VMware is a lot of fun. We have multiple VMware environments at work, so I longed for a simple menu to stick in front of some scripts I used for various reports against those environments. After some searches, I came up with the Windows PowerShell Tip of the Week archives under 'User Input' from the Script Center. It had some interesting suggestions, some fancy, some to simple for my use. I longed for the old text base menus that were simple to toss together and easy for neophytes to understand.

I had this vague recollection of select .. case in VBScript so on the VBScript to Windows PowerShell Conversion Guide I followed the link to VBScript commands and then to Select .. case.

Here I found a nice little, short article on switch. It looked simple enough and a quick check in my PowerShell console showed that Get-Help About_Switch had some more stuff. I still have to play with it some more but now I have my nice, simple menu to authenticate to the different environments with one script.

Syndicate content