question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request / Get-Command <a cmdlet alias> should return the full info.

See original GitHub issue

Summary of the new feature/enhancement

Get-Command <a cmdlet alias> should return the same info as to Get-Command <cmdlet full name>.

But currently, Get-Command <a cmdlet alias> only returns the cmdlet full name.

Demo on Invoke-WebRequest and its alias iwr


# Get-Command without any params

6.2.2> gcm iwr

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           iwr -> Invoke-WebRequest


6.2.2> gcm Invoke-WebRequest

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Invoke-WebRequest                                  6.1.0.0    Microsoft.PowerShell.Utility

# Get-Command with the param -Syntax

6.2.2> gcm iwr -Syntax
Invoke-WebRequest

6.2.2> gcm Invoke-WebRequest -Syntax

Invoke-WebRequest [-Uri] <uri> [-UseBasicParsing] [-WebSession <WebRequestSession>] [-SessionVariable <string>] [-AllowUnencryptedAuthentication] [-Authentication <WebAuthenticationType>] [-Credential <pscredential>] [-UseDefaultCredentials] [-CertificateThumbprint <string>] [-Certificate <X509Certificate>] [-SkipCertificateCheck] [-SslProtocol <WebSslProtocol>] [-Token <securestring>] [-UserAgent <string>] [-DisableKeepAlive] [-TimeoutSec <int>] [-Headers <IDictionary>] [-MaximumRedirection <int>] [-MaximumRetryCount <int>] [-RetryIntervalSec <int>] [-Method <WebRequestMethod>] [-Proxy <uri>] [-ProxyCredential <pscredential>] [-ProxyUseDefaultCredentials] [-Body <Object>] [-Form <IDictionary>] [-ContentType <string>] [-TransferEncoding <string>] [-InFile <string>] [-OutFile <string>] [-PassThru] [-Resume] [-PreserveAuthorizationOnRedirect] [-SkipHeaderValidation] [<CommonParameters>]

Proposed technical implementation details (optional)

We expect to see exactly the same info between Get-Command iwr and Get-Command Invoke-WebRequest. And the same for all the params.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
BrucePaycommented, Sep 9, 2019

One important use of Get-Command is to find out what kind of command you have. Hiding the fact that your command is an alias by default is highly undesirable. However, I think it’s reasonable for Get-Command -Syntax to “follow the link” and give you the syntax of the aliased command. If this is done, I don’t see a particular need for a -Resolve parameter.

1reaction
mklement0commented, Sep 8, 2019

Good points, @copdips and @kilasuit - adding a -Resolve switch has been proposed before, in #7387

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Get-Command ?' returns % (ForEach-Object alias) and ...
This issue is relevant to the new PSSA bug PowerShell/PSScriptAnalyzer#1209 and relates to probably any version of PowerShell Steps to ...
Read more >
Get-Help (Microsoft.PowerShell.Core)
The Get-Help cmdlet displays information about PowerShell concepts and ... If you specify the exact name of a command alias, Get-Help displays the...
Read more >
How to make a function be an alias to a cmdlet
I want to do it without using Set-Alias/New-Alias because I do not want the Aliases to show up when we do Get-Command from...
Read more >
Windows PowerShell Cheat Sheet
Get -Alias sends ca 160 objects (aliases) through the pipeline. All objects have the property name , which is matched against a regexp....
Read more >
An A-Z Index of Windows PowerShell commands
An A-Z Index of Windows PowerShell commands. Get-Acl, Set-Acl, Get-Alias, Get-ChildItem, Get-Command, Add-Content, Get-Content, Set-Content, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found