Get-Command should return full cmdletbinding details
See original GitHub issuePowerShell Functions and Cmdlets can be decorated with the [CmdletBinding()]
attribute with additional properties being able to be defined including SupportsShouldProcess
, ConfirmImpact
, DefaultParameterSetName
,HelpURI
, SupportsPaging
, PositionalBinding
Currently we do not output details on this other than it being True if set and we don’t return it as false if it is not set and we should return it as either a simple False
if not set at all or should return an object with the above properties as defined in the command
Steps to reproduce
Get-Command Disable-PNPDevice | Select -ExpandProperty CmdletBinding
Expected behavior
Actual behavior
Environment data
Whilst the screenshot’s are from ps v5.1 this also affects v7.0.0.preview.4
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:9 (3 by maintainers)
Top Results From Across the Web
about Functions CmdletBindingAttribute - PowerShell
The CmdletBinding attribute is an attribute of functions that makes them operate like compiled cmdlets written in C#.
Read more >Learn How PowerShell CmdletBinding Enhances Functions
In this tutorial, you will learn how to use the PowerShell CmdletBinding attribute to enhance functions and make them behave like cmdlets.
Read more >How to test that a powershell function has a cmdletbinding ...
I'm trying out writing test-driven PowerShell code using Pester. Is there a way to test if a function has a certain CmdletBinding attribute, ......
Read more >about Functions OutputTypeAttribute - PowerShell
FunctionInfo object that the Get-Command cmdlet returns. The OutputType attribute value is only a documentation note.
Read more >Creating Safer PowerShell Functions
As you can see, [CmdletBinding()] is added to the param() block. But why? After all, the attribute is completely empty and defines no...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can get that one today as well, although it’s rather buried. Would be nice to get at it a bit more easily, but this does work for functions:
Note that for binary cmdlets it would be
CmdletAttribute
rather thanCmdletBindingAttribute
. I agree that both should provide this information more readily though.For binary cmdlets, there is at least a quick workaround with public API’s: