What's your top Powershell command? Let's make a list and vote up the best ones!
|
closed as not constructive by Mark Henderson♦ Jan 15 '12 at 5:38
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
|
Get-Member is the king of PowerShell cmdlets. Get-Member allows you to interactively explore objects' members and types' (with the -static switch) static members. |
|||
|
|
|
I like having a script for finding AD users:
|
|||||||||||||
|
|
I have to go with get-help. This cmdlet is the key to finding the functionality of other cmdlets. A close second would be get-member. |
||||
|
|
|
"Test-Path" finding this useful for checking if data is already there or if a default needs to be added. |
||||
|
|
|
For me -WhatIf is the most useful. |
|||
|
CD (Change-Location) - I can basically navigate around registry as if it is a file system. basically you can do so for all powershell providers (returned by Get-PSProviders)
|
||||
|
|
|
No question about it - Get-Member. I can't imagine any PowerShell session without using it. Discoverability is one of the strongest features of Windows PowerShell. |
|||
|
|
|
One of my favorites:
The powershell-version of 'tail -f 'logfile' |
|||||
|
|
I see Get-Member listed which I have to agree is the best but a near and equally neccessary second for me is:
The way I more commonly use this is after a pipe to show me all the values of the properties of an object:
GM will tell you what the object is and list out the names and types of its properties but more often than not this does not help you really understand the way those properties are used without looking up the documentation which can be tedious.
I will often find that an object has multiple properties that based on the documentation look like they have the data I want but in reality only one of the properties has data or the data in one of them is not at all what you would expect based on the documentation alone. |
||||
|
|
|
I did just a small method that i added to my Profile. See http://blog.keystroke.ch/2007/08/30/diskusage-in-powershell/. diskusage myserver is my prefered command. |
|||
|
|
|
This is more of a technique than a particular cmdlet or function, but my favorite PS thing is object construction:
gives you
which is handy for turning unstructured data into a set of objects for further processing. |
|||
|
|
|
In addition to Get-Member, I would have to say Add-Member and New-Object which give you the ability to use the Extensible Type System. Being able to add members to any object at any time allows you to get the exact information you need with the ability to sort it, group it, slice it, dice it, export it, or whatever you want to do with it. |
|||
|
|