Posts

Showing posts from March, 2014

Accessing a Property of All Objects in a PowerShell Array

If you've looked at the scripts that I've written, you may have noticed that I use a fairly simple bit of syntax whenever I need to access a single property from all objects in an array (in PowerShell).  I just wrote that sentence and even I'm not entirely sure what it means, so I'd better use an example.  Try this: $events = get-eventlog -newest 10 $events.source What output did you see?  If you saw a list of 10 sources, congratulations, your PowerShell is at least version 3!  If you saw no output, then you should really update your PowerShell.  This is the functionality that I mean - the ability to easily generate an array of a single Property (in this case, Source) from an array of objects. I bring this up because that functionality is super useful.  For example, I was recently writing a script for a customer that involved analyzing a bunch of AD Users and I needed to manipulate a single Property and then select users based on that Property (I'm ...

View Client Version Numbering

I don’t know if anyone else was confused about this, but VMware’s View Client versioning scheme is a little counterintuitive (at least, for Windows clients).  Thus, if you go to download the View client , make sure that you download what you really want. Here’s the details: First, you'll see that there are two major versions: Version 1.0 and Version 2.0. Version 1.0 includes Windows View Client versions 5.2.1 and earlier, which corresponded nicely with Horizon View Server 5.2 and earlier.  After that, it gets a bit odd. Version 2.0 includes Windows View Client versions 5.3.0 and newer.  Sounds easy… but what’s newer than 5.3.0?  Well, 5.4.0 is newer.  But, so is 2.2.0… and 2.3.0. The reason that this happened is that some really cool features (mostly around media redirection and processing) have been developed as Client technologies without requiring changes on the server side (thus incrementing the Client version without incrementing the Server version)....

PowerShell Sorting by Multiple Columns

PowerShell's Sort-Object cmdlet is super useful, especially when preparing output for human consumption.  A few people have found my blog while looking for more information about its use, specifically while looking for how to sort by multiple columns (well, properties, technically).  I've never done so (much less written about it), so I hope those folks found answers elsewhere.  But, it got me curious... and it turns out that it's really easy. The Technet article on Sort-Object has the answer directly spelled out: just use commas to create a list of properties to sort by (in order to precedence).  Let's look at some examples!  First, prepare a variable with some good sortable data: $myData = get-eventlog System -newest 25 And then we can get to sorting!  Say you want to sort primarily by EntryType (Warning, Information, Error) and then by Source.  Easy-peasy: $myData | sort EntryType,Source How about if you want it to be in descending or...