views:

843

answers:

12

I just found /n softwares free Powershell NetCmdlets, and after playing with them I love the functionality they bring to the command line. So it raises the question what are your favorite Cmdlets, and how do you use them?

A: 

While semi-related to your question, it does not entirely fit the Powershell NetCmdlets motif. But I wanted to post it anyhow as I use it daily and it may help others. Simply making shift-control-c key combo into displaying the visual studio command prompt.

Pat
+1  A: 

I wrote a PowerShell provider to give me access to IE7's RSS feed store, and had lots of fun with it. It lets me cd to a drive called feed: and navigate around folders and feeds using cd and dir. It even lets you add or remove feeds from the command line.

See this post on my blog as an example:

Getting the Most Prolific Authors in your Feeds

It's rolled up into the PowerShell Community Extensions project nowadays, which you can find on CodePlex here.

Matt Hamilton
+6  A: 

there's an out-twitter script i use for posting to twitter. it's nice, as it means you can send something to twitter without the risk of being distracted by a browser.

i added an alias for it, "twit".

so now you can type, for example:

PS C:\>"trying out stack overflow" | twit

and if successfully lodged, it will return an integer that identifies your post.

Leon Bambrick
+1  A: 

While it is not as fun as Out-Twitter, my favorite cmdlet is Get-Member, since it allows me to examine any of the objects I'm working with and find out new properties and methods, as well as the underlying type of the object.

If I did not choose Get-Member, I would have to go with Out-Clipboard from the PowerShell Community Extensions (PSCX), as it enables a whole lot of clipboard automation and makes using PowerShell for code templating much easier.

Steven Murawski
+1  A: 

Well it is a little bland, but I would vote for Get-Help.

EBGreen
A: 

ls (Get-ChildItem) rm (Remove-Item) ps (Get-Process)

and the rest of my familiar commands that now "just work" :)

but seriously... New-Object would have to get my vote. With it, powershell can do ANYTHING :)

slipsec
+6  A: 
Jaykul
Hey jaykul, I noticed you posted a weather forecast for my home town. Well Rush, NY, is my home town, but West Henrietta is like a second home town. :) Nice to meet you.
Nick Berardi
+1  A: 

Get-Member, hands down. No, it's not very glamorous, but the ability to inspect objects interactively beats interrupting your work to go hit up MSDN.

halr9000
A: 

I find Get-member to be the most useful native PowerShell cmdlet. I also use Get-WMIObject on a daily basis. Even if I'm troubleshooting a VBScript problem for someone I'll turn to Get-WMIObject because I can work with WMI interactively.

Jeffery Hicks
+2  A: 

Set-Clipboard, found on the PowerShell Community Extensions project on CodePlex. Usually when I'm working in PowerShell, the ultimate goal is to generate some text or even an Excel spreadsheet. Set-Clipboard eliminates all of the intermediate "save it to a file, ok now open that file, select all, copy to clipboard" steps--you do it all in PowerShell.

Peter Seale
A: 

The combination of Get-WMIObject and Get-Member is something I use throughout the workday. Working on Get-Sandwich.

stahler
A: 

export-csv. This creates a nice report in a manager-friendly Excel-ready format. Bonus points if you have community extensions installed and user send-smtpmail.

Management report in their inbox from the commandline. Nice.

jwmiller5