How it works...

We saw while reading about the Core and its capabilities, that PowerShell, most of the time, returns objects. And every object can have objects within itself. Going by the same path as that of .NET, a member access operator can be used to select the members (which could be properties or methods). Properties are addressed by simply using the property names, while methods need arguments passed to them (an empty pair of parentheses is still needed if no argument is being passed). 

The parameters of a cmdlet are objects of the output that the Get-Command cmdlet returns. Therefore, calling Get-Command with the cmdlet, Invoke-Command returns data about Invoke-Command as the output object. This can be further broken down to several other objects (members), among which, there is Parameters.

Parameters itself can be further broken down into other members, Values being one of them—Values contains the names of the parameters, as revealed by running Get-Member

We select two objects from within Values, called Name and Aliases

These parameter aliases can be used in place of parameters themselves. 

There are two caveats with parameter aliases: 

  • They are case-sensitive, which means reaching for the Shift key. 
  • They have to be remembered, even though they have a pattern to them, just like how cmdlet aliases do (ip for Import and g for Get, for instance).
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.111.125