Pages

Thursday, June 11, 2009

Most Power Full commands in PowerShell

Today I am going to talk about the 3 most power full commands you need to know to get started on PowerShell.

The three Power Full Commands are
1) get-help
2) get-command
3) get-member

get-help command displays the information about cmdlets and concepts. You can also use “help” command to get the same kind of information.

PowerShell DotNetVJ:\> Get-help get-command

This command would display short or one page description about the command. If you want more and detailed information then you need to pass “-Detailed” parameter.

PowerShell DotNetVJ:\> Get-help get-command -Detailed

The above command displays all the information related to get-command which spans in multiple and you have scroll thru to read everything. Add “ more” to limit the out put to one page and press Space key to continue.

You can also get the help about get-help command.

PowerShell DotNetVJ:\> Get-help get-help

Get-command command displays the information about cmdlets and other elements of PowerShell commands.

PowerShell DotNetVJ:\> get-command

The above command displays all the cmdlets. You can also use wild characters to limit the records.

Lets say you want to display all the cmdlets starting with “write” then simply issue the below command.

PowerShell DotNetVJ:\> get-command write*

Get-Member gets information about the members of objects. This method can accept the value from the pipeline or from inputObject parameter. Your output depends on how you are passing the input to this command.

PowerShell DotNetVJ:\> get-command get-member


This one gave just the definition of the get-member. Now lets look at the command with Pipe character.

PowerShell DotNetVJ:\> get-command get-member
If you look at the output both are totally different. The one with pipe gave lot of information like what are the methods that are allowed on this get-command.

No comments: