Advertisements
Latest Posts

Some Powershell Basics and help commands that you should know


I have explained a little bit about what is Parameter Name, Parameter Value, Mandatory & Optional Parameters, Positional Parameters and help commands in the Powershell.

Powershell command Syntax :

Untitled

Mandatory Parameters:

Mandatory Parameters isn’t enclosed with Square brackets. You must need to give mandatory parameter when run commands otherwise it will prompt for you provide Parameter value.

Ex:

Get-EventLog   [-LogName] <String>    [-ComputerName <String[]>]

Optional Parameters:

Powershell list the optional Parameters within Square brackets.It’s not mandatory and you don’t need to use it at all if you don’t want.

Ex:

Get-EventLog   [-LogName] <String>    [-ComputerName <String[]>]

Positional Parameters:

Positional Parameters are the parameters that you are most frequently using. You can directly provide Parameter Value and no need to type Parameter Name. Parameter name is enclosed with Square brackets.

I have highlighted Positional Parameters where Parameters names are enclosed with Square brackets. So you no need to type Parameter names

Ex:

Get-EventLog [-LogName] <String>  [[-InstanceId] <Int64[]>]   [-After <DateTime>] [-ComputerName <String[]>] [-EntryType <String[]>]

 

Get- Help Commands:

To see the examples, type: “get-help Get-EventLog -examples“.
For more information, type: “get-help Get-EventLog -detailed“.
For technical information, type: “get-help Get-EventLog -full“.
For online help, type: “get-help Get-EventLog -online

Get-Command  -> To List all commands or  if you weren’t sure about command you can use wildcards.

5

Show-Command ->

If you are struggling with the commandline, you can use Show-Command line and it will graphically prompt you to provide the values.

Ex:

3

It will list the EventLog which is under Application.

4

 

 

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s