PowerShell / PowerShell/PSScriptAnalyzer
Should PSScriptAnalyzer suggest use of the RemotingCapability cmdlet attribute when a ComputerName parameter is used?
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
This is just a point of discussion. I just came across the RemotingCapability cmdlet attribute and it made me wonder whether or not I should be using it in commands I write that do something remotely. The easiest way I can think of to identify such a command is to detect the presence of a ComputerName parameter. For such commands, is using the RemotingCapability attribute a best practice? I have written many commands that do things remotely, and have yet to use this attribute.
Since many core commands use this rule, presumably it offers some value. Here's a one-liner to see which core commands use this rule:
gcm -module Microsoft.* | % {$md = new-object system.management.automation.commandmetadata $_; $md} | ft Name,RemotingCapability
If RemotingCapability is recommended for commands that do remote management, then PSScriptAnalyzer should probably have a rule to guide users in the right direction (detecting when that attribute is missing where it should be used).
To be honest, at this point I have no idea where/how RemotingCapability is used in PowerShell or PowerShell tools. Is it informational? Does it impact command execution? Or do tools provide script authoring tips, etc?
This should be reviewed so that a rule can be identified if it would help people use this attribute where appropriate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the RemotingCapability cmdlet attribute, ComputerName parameters, and the listed Microsoft.* core commands to determine how the attribute is used and whether it affects execution or authoring guidance. Done means documenting the recommendation and deciding whether a PSScriptAnalyzer rule is appropriate, including a clear scope for detecting missing attributes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100