Windows #Powershell Bits

Been stuck in a meeting and wanted to look a bit interested in that I was taking notes, so I have look around Powershell on my Windows 7 laptop.

Found some kewl stuff.  Lets start with:

  • Get-Hotfix
    The Get-Hotfix cmdlet gets the hotfixes that have been applied to the local computer or to remote computers by Component-Based Servicing.
  • Get-Random
    The Get-Random cmdlet gets a randomly selected number. If you submit a collection of objects to Get-Random, it gets one or more randomly selected objects from the collection.

Now Get-Random is really funky.  You can run it like:

  • Get-Random -Maximum 99
    This will get you a number between 0 and 99
  • Dir | Get-Random
    Will pick a random file from the dir
  • Dir | Get-Random -Count 3
    Will pick 3  random files from the dir
  • 1..99 | Get-Random -Count 3
    This will get 3 random numbers between 0 and 99

How kewl is that?