Skip to content

Should PSScriptAnalyzer suggest use of the RemotingCapability cmdlet attribute when a ComputerName parameter is used? #397

Open
@KirkMunro

Description

@KirkMunro

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions