Compartilhar via


CommandMetadata.GetRestrictedCommands(SessionCapabilities) Method

Definition

Returns a dictionary from a command name to CommandMetadata describing how that command can be restricted to limit attack surface while still being usable by features included in sessionCapabilities.

For example the implicit remoting feature (included in RemoteServer) doesn't use all parameters of Get-Help and uses only a limited set of argument values for the parameters it does use. CommandMetadata can be passed to Create(CommandMetadata) method to generate a body of a proxy function that forwards calls to the actual cmdlet, while exposing only the parameters listed in CommandMetadata. Exposing only the restricted proxy function while making the actual cmdlet and its aliases private can help in reducing attack surface of the remoting server.

public:
 static System::Collections::Generic::Dictionary<System::String ^, System::Management::Automation::CommandMetadata ^> ^ GetRestrictedCommands(System::Management::Automation::SessionCapabilities sessionCapabilities);
public static System.Collections.Generic.Dictionary<string,System.Management.Automation.CommandMetadata> GetRestrictedCommands (System.Management.Automation.SessionCapabilities sessionCapabilities);
static member GetRestrictedCommands : System.Management.Automation.SessionCapabilities -> System.Collections.Generic.Dictionary<string, System.Management.Automation.CommandMetadata>
Public Shared Function GetRestrictedCommands (sessionCapabilities As SessionCapabilities) As Dictionary(Of String, CommandMetadata)

Parameters

sessionCapabilities
SessionCapabilities

Returns

Applies to

See also