Random Tip of the Day

Get-Random has a dual purpose. It can provide you with a random number and also pick random elements from a collection. So, if you want to get a new random PowerShell "Tip of the Day," you should try this:

Get-Help about_* | Get-Random | Out-Host -Paging

Likewise, if you want to learn a new random PowerShell cmdlet each day, you can use this:

Get-Command -CommandType Cmdlet | Get-Random | Get-Help

Many Get-*-Cmdlets, such as Get-EventLog or Get-Process, will output data in columns and support parameters named like these columns. So if you need to filter the results, you should just look at the column you want to filter on, then use the parameter named like the column, and add your filter criteria:

Get-EventLog System -EntryType Error
Get-Process -ID $pid

Twitter This Tip! ReTweet this Tip!


Posted Apr 26 2010, 08:00 AM by ps1

Comments

Twitter Trackbacks for Random Tip of the Day - Power Tips - PowerShell.com [powershell.com] on Topsy.com wrote Twitter Trackbacks for Random Tip of the Day - Power Tips - PowerShell.com [powershell.com] on Topsy.com
on 04-26-2010 10:12 AM

Pingback from  Twitter Trackbacks for                 Random Tip of the Day - Power Tips - PowerShell.com         [powershell.com]        on Topsy.com

uberVU - social comments wrote Social comments and analytics for this post
on 04-26-2010 10:48 AM

This post was mentioned on Twitter by sharepointsara: RT @PowerTip Random #PowerShell Tip of the Day http://bit.ly/bH9Nlk

draugasvd wrote re: Random Tip of the Day
on 05-14-2010 4:09 AM

how I can send tip of the day to email?

if I try use:

$subject = "[$date] PCOD"

$body = Get-Command -CommandType Cmdlet | Get-Random  | Get-Help

Send-MailMessage -to $to -subject $subject -from $from -smtpserver $smtp -body $body

I getting object, but not help text.

draugasvd wrote re: Random Tip of the Day
on 05-14-2010 4:19 AM

I found: out-string

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.