The three most useful commands in Powershell

Well for me anyway. šŸ˜‰

If I had asked you to guess I am doubtful anyone would have guessed . These three are Get-Help, Get-Command,Get-Member. 
If I had known about about these earlier in my powershell study it would have made my life a while lot easier . 

Many people who first start learning Powershell go straight to the Internet to search for their scripting answers/help . The problem with that is that while the script may solve a generic problem no proper understanding of Powershell concepts will mean it is harder to build your own. 

Anywho I am digressing. 

Get-Help is just that. Getting help on all the cmdlets that you are available in Powershell. You can even use wild cards. 

For example Get-Help *aduser* will show all the commands (in this case all things related to active directory users if you have Active Directory modules loaded). 
Get-Command is something similar . But it just searches commands. There can be well over 2000 cmdlets in the latest version of Windows and more if you have modules.

Example is Get-Command g*aduser* -module Activedirectory. This pulls all commands from active directory that has start with the verb g and the noun aduser. Powershell is very smart in this regard. 

Get-Member is a very important cmdlet. This cmdlet will show all members of an object. All cmdlets are objects so in essence it tells what what you can refer to. 

Example: Get-Service | Get-Member should produce the members of Get-Service. You can then reference all of these properties. 

With these three commands I found I could find my way around powershell and not depend on Google. Hopefully this helps all you guys learning the Shell. :)

Leave a Reply

Your email address will not be published. Required fields are marked *