Get-AzVmssVMRunCommand
The operation to get the VMSS VM run command.
Syntax
Default (Default)
Get-AzVmssVMRunCommand
-ResourceGroupName <String>
-VMScaleSetName <String>
-InstanceId <String>
[-RunCommandName <String>]
[-Expand <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The operation to get the VMSS VM run command.
Examples
Example 1: Get a Run Command for VMSS VM instance
Get-AzVmssVMRunCommand -ResourceGroupName MyRG0 -VMScaleSetName MyVMSS -InstanceId 0 -RunCommandName MyRunCommand
Get a Run Command for VM without Instance View.
Example 2: Get a Run Command for VMSS VM instance with Instance View
$x = Get-AzVmssVMRunCommand -ResourceGroupName MyRG0 -VMScaleSetName MyVMSS -InstanceId 0 -RunCommandName MyRunCommand -Expand InstanceView
$x.InstanceView
ExecutionState : Succeeded
ExecutionMessage :
ExitCode : 0
Output : Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 10/27/2022 9:10 PM 0 HelloWorld2022-10-27T21.10.54.9266231+00.00.txt
Error :
StartTime : 10/27/2022 9:10:52 PM
EndTime : 10/27/2022 9:10:55 PM
Statuses :
Get a Run Command for VM with Instance View. Instance View contains execution state of run command (Succeeded, Failed, etc.), exit code, standard output and standard error generated by executing the script using Run Command. A non-zero ExitCode indicates an unsuccessful execution.
Example 3: Get all Run Commands for a VMSS VM instance
Get-AzVmssVMRunCommand -ResourceGroupName MyRG -VMScaleSetName MyVMSS -InstanceId 1
Get list of all Run Commands for a VM.
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: | IAzureContextContainer |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | AzContext, 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 |
-Expand
The expand expression to apply on the operation. For instance view, pass in "InstanceView".
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: | True |
Value from remaining arguments: | False |
-InstanceId
Instance ID of the virtual machine for from the VM scale set.
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: | True |
Value from remaining arguments: | False |
-ResourceGroupName
Name of the resource group for the run command.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | True |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-RunCommandName
Name of the run command.
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: | True |
Value from remaining arguments: | False |
-VMScaleSetName
Name of the virtual machine scale set of the run command.
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: | True |
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.