-
Notifications
You must be signed in to change notification settings - Fork 0
Invoke NativeCommand
Invokes a native command with an argument array.
Invoke-NativeCommand [-Executable] <String> [-Sudo] [[-SudoAs] <String>] [[-Parameters] <String[]>]
[<CommonParameters>]
Invokes an executable without constructing PowerShell source code, optionally applies sudo preferences on Linux or macOS, and redirects standard error into the success stream for downstream parsing.
Invoke-NativeCommand -Executable 'git' -Parameters '--version'
Invokes git and returns its combined standard output and standard error.
Specifies the native executable or command to invoke.
Type: String
Parameter Sets: (All)
Aliases: Command
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies native argument values in their required order.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseInvokes the command through sudo on Linux or macOS.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseInvokes the command through sudo -u for the specified user on Linux
or macOS.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
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.