-
Notifications
You must be signed in to change notification settings - Fork 0
Add SudoPreferenceRule
Adds or changes a sudo preference rule.
Add-SudoPreferenceRule -Executable <String> -ParameterFilterRule <Object> [-SudoUser <String>]
[<CommonParameters>]
Add-SudoPreferenceRule [-EnableSudoForAllCommands] [-SudoUser <String>]
[<CommonParameters>]
Add-SudoPreferenceRule [-DisableSudoForAllCommands] [<CommonParameters>]
Registers a command-specific sudo rule or enables or disables sudo for every native command. Parameter filters must be script blocks or the wildcard string '*'. Script blocks are retained without recompilation.
Add-SudoPreferenceRule -Executable 'dpkg' -ParameterFilterRule {
$args -contains '--install'
}
Adds a rule that uses sudo for dpkg installation commands.
Add-SudoPreferenceRule -EnableSudoForAllCommands -SudoUser 'root'
Enables sudo for all native commands and selects the root user.
Disables the global sudo preference without deleting command rules.
Type: SwitchParameter
Parameter Sets: NoSudoAll
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseEnables sudo for every native command.
Type: SwitchParameter
Parameter Sets: SudoAll
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the executable to which the rule applies. Use '*' with a wildcard or constant script-block filter to configure all commands.
Type: String
Parameter Sets: Sudo
Aliases: Command
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies '*' to match every argument list or a script block that evaluates the command arguments through its automatic $args variable.
Type: Object
Parameter Sets: Sudo
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the user supplied to sudo -u when the matching rule applies.
Type: String
Parameter Sets: Sudo, SudoAll
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.