Picking Random Items

by Oct 6, 2009

In PowerShell V2, Get-Random retrieves as many random numbers as you like, allowing you to use this random number generator in many scenarios. A more unusual way would be to pick a random tip of the day:

"Tip 1","Tip 2","Tip 3" | Get-Random

Of course, you could also get two random processes and kill them if memory runs out (which could be a career-limiting move):

Get-Process | Get-Random -Count 2 | Stop-Process -whatIf

Twitter This Tip! ReTweet this Tip!