Question

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?

Was it helpful?

Solution

As a programmer/hacker, Get-Member and Get-Command are the ones I use more than any others, but the ones I use to show off are Select-Control and Send-Keys from WASP, the PowerGadgets, and some of my own stuff written in WPF against CTP2 or PoshConsole ;-)

Weather in PoshConsole

OTHER TIPS

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.

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.

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.

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.

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.

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

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.

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.

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 :)

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.

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

I do alot of work with Microsoft Lync 2010 which includes a set of synthetic for testing functionality. Of these Test-CsPstnOutboundCall is my favourite.

For general scripting got to vote for get-member and get-help :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top