Edit

Share via


Invoke-AzNetworkCloudBareMetalMachineRunCommand

Run the command or the script on the provided bare metal machine. The URL to storage account with the command execution results and the command exit code can be retrieved from the operation status API once available.

Syntax

RunExpanded (Default)

Invoke-AzNetworkCloudBareMetalMachineRunCommand
    -BareMetalMachineName <String>
    -ResourceGroupName <String>
    -LimitTimeSecond <Int64>
    -Script <String>
    [-SubscriptionId <String>]
    [-Argument <String[]>]
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

RunViaIdentityExpanded

Invoke-AzNetworkCloudBareMetalMachineRunCommand
    -InputObject <INetworkCloudIdentity>
    -LimitTimeSecond <Int64>
    -Script <String>
    [-Argument <String[]>]
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Run the command or the script on the provided bare metal machine. The URL to storage account with the command execution results and the command exit code can be retrieved from the operation status API once available.

Examples

Example 1: Run script on bare metal machine

Invoke-AzNetworkCloudBareMetalMachineRunCommand -BareMetalMachineName bmmName -ResourceGroupName resourceGroupName -SubscriptionId subscriptionId -LimitTimeSecond limitTimeInSeconds -Script "bHM=" -Argument "-l" -Debug

This command runs the provided script on a bare metal machine. Including the -Debug flag ensures successful output of the storage account URL containing the command's results. This is necessary to retrieve the results of the command on the bare metal machine.

Parameters

-Argument

The list of string arguments that will be passed to the script in order as separate arguments.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AsJob

Run the command as a job

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BareMetalMachineName

The name of the bare metal machine.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

RunExpanded
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRMContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

Parameter properties

Type:INetworkCloudIdentity
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

RunViaIdentityExpanded
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-LimitTimeSecond

The maximum time the script is allowed to run.If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit code matching a timeout will be returned (252).

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NoWait

Run the command asynchronously

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

Returns true when the command succeeds

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

The name of the resource group. The name is case insensitive.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

RunExpanded
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Script

The base64 encoded script to execute on the bare metal machine.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SubscriptionId

The ID of the target subscription. The value must be an UUID.

Parameter properties

Type:String
Default value:(Get-AzContext).Subscription.Id
Supports wildcards:False
DontShow:False

Parameter sets

RunExpanded
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

INetworkCloudIdentity

Outputs

Boolean