All posts by Jeffery Hicks

Blog RSS Changes

After fighting the last few weeks trying to get Feedburner to work, I’ve decided to revise a few things. First off,  the new RSS feed for my blog is http://jdhitsolutions.com/blog/feed. The old link will remain active but eventually slowly die.  But what I really hope you’ll consider is signing up for my mailing list. Yeah, I know another mailing list and more spam.  Well, I don’t have time for any of that any more than you do. The email list will get daily RSS notices. That’s the primary purpose for the list. However, I might on occasion send out an email about something I’m up to which I think you will be interested in such as a new book, course or conference appearance.

I’m using MailChimp so it is easy for you to manage your preferences and opt out.  If you are interested the sign up form is simple. You will need to confirm your email address.

Finally, I probably don’t say it enough, but thank you for taking the time to read what I post here, buy my books, come to my conference sessions or watch my Pluralsight courses. Without you I’d just be an old man sitting in a room by himself all day.

More Fun Getting PowerShell User Groups

A few days ago I posted a PowerShell function to retrieve information about PowerShell user groups. That function returned basic group information like this.

Each group on the site has its own page which is what that Link property is for. So it didn’t take much work to use the same techniques as my original post to scrape information from that page. Again, I needed to analyze the source code to determine what classes and properties to use. But the final function, isn’t that much different than the first one.

Now I can get the group detail directly from PowerShell.

If you have both commands, you can even combine them.

This isn’t too bad.

You could use PowerShell to get details for every single group but that can be time consuming as processing is done sequentially. One way you might improve performance is my taking advantage of the parallel foreach feature in a PowerShell workflow. I wrote another function, really more as a proof of concept that defines a nested workflow. Within this workflow, it processes a collection of links in parallel in batches of 8.

Because workflows are intended to run isolated, I had to incorporate code from Get-PSUserGroupDetail, instead of trying to call it directly. Here’s the complete function.

But even with parallel processing, this is still not a speedy process. Running the command on my Windows 8.1 box with 8GB of RAM and a very fast FiOS connection still took about 2 minutes to complete. But I suppose if you don’t mind waiting here’s what you can expect.

I will say, that having all of this information is fun to play with.

Or you could do something like this.

My last function on the topic is called Show-PSUserGroup. The central command runs my original Get-PSUserGroup function which pipes the results to Out-Gridview. From there you can select one or more groups and each group’s link will open up in your browser.

Clicking OK opens each link in my browser.

If you’ve collected all of my functions, I recommend creating a module file. I have all of them in a module file called PSUsergroups.psm1. All you need at the end is an export command.

Save the file in the necessary module location and your commands are ready when you are.

NOTE: If you run a PowerShell User Group and you are not registered on this site, I strongly encourage you to do so. Otherwise you are making it very hard for people to find you.

Friday Fun: Get PowerShell User Groups

The other day Don Jones tweeted about find a PowerShell user group. In case you didn’t know, just about every user group associated with PowerShell can be found online at http://powershellgroup.org. This is a terrific resource for finding a user group near you. Of course, Twitter being what it is someone joked about the lack of a Get-PSUserGroup cmdlet. So, taking the joke as a challenge I built on. Don also was going to build something but I haven’t seen what he came up with. I suspect it will be similar to mine.

Because we there is a web site, we can scrape it with Invoke-WebRequest.

Instead of trying to parse the document object model (DOM), the resulting object has a property called AllElements which is exactly what the name implies. I had to look at the source HTML on the page to identify the elements I needed to reference. Since it seemed I could get what I want via an HTML class, I grouped the elements by class and turned it into a hashtable.

I opted for a hashtable to make it easier to get all the elements for a given class. For example, I knew the ‘views-field views-field-title’ class would give me the name of each group.

Likewise I knew the ‘views-field views-field-description’ class would provide a description.

Knowing what each object looked like, you could also pipe to Get-Member to discover property names, made it easy to extract the relevant information.

Once I had the core concepts down, I built an advanced function around them called Get-PSUserGroup.

The command doesn’t take any parameters and simply returns high level information about each group.

The pipelined object includes a link to the group’s page which means you could try something like this:

All of the groups are sent to Out-GridView.

Select one or more groups and each link should open in your browser. Now you have no excuse for not finding a PowerShell User Group. And if here isn’t one near you, start it!

I have some other interesting things on this topic, but I’ll save those for another day. Enjoy!!