Skip to content

Add cmdlet help examples for RunCommand v2 (Set, Get) cmdlets #19969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/Compute/Compute.Autorest/docs/Get-AzVMRunCommand.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Example 1: Get a Run Command for VM

```powershell
Get-AzVMRunCommand -ResourceGroupName MyRG -VMName MyVM -RunCommandName MyRunCommand
```

Get a Run Command for VM without Instance View.

### Example 2: Get a Run Command for VM with Instance View

```powershell
$x = Get-AzVMRunCommand -ResourceGroupName MyRG -VMName MyVM -RunCommandName MyRunCommand -Expand InstanceView
$x.InstanceView
```

```output
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 VM

```powershell
Get-AzVMRunCommand -ResourceGroupName MyRG -VMName MyVM
```

Get list of all Run Commands for a VM.
42 changes: 42 additions & 0 deletions src/Compute/Compute.Autorest/docs/Get-AzVmssVMRunCommand.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Example 1: Get a Run Command for VMSS VM instance

```powershell
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

```powershell
$x = Get-AzVmssVMRunCommand -ResourceGroupName MyRG0 -VMScaleSetName MyVMSS -InstanceId 0 -RunCommandName MyRunCommand -Expand InstanceView
$x.InstanceView
```

```output
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

```powershell
Get-AzVmssVMRunCommand -ResourceGroupName MyRG -VMScaleSetName MyVMSS -InstanceId 1
```

Get list of all Run Commands for a VM.
42 changes: 42 additions & 0 deletions src/Compute/Compute.Autorest/examples/Get-AzVMRunCommand.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Example 1: Get a Run Command for VM

```powershell
Get-AzVMRunCommand -ResourceGroupName MyRG -VMName MyVM -RunCommandName MyRunCommand
```

Get a Run Command for VM without Instance View.

### Example 2: Get a Run Command for VM with Instance View

```powershell
$x = Get-AzVMRunCommand -ResourceGroupName MyRG -VMName MyVM -RunCommandName MyRunCommand -Expand InstanceView
$x.InstanceView
```

```output
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 VM

```powershell
Get-AzVMRunCommand -ResourceGroupName MyRG -VMName MyVM
```

Get list of all Run Commands for a VM.
42 changes: 42 additions & 0 deletions src/Compute/Compute.Autorest/examples/Get-AzVmssVMRunCommand.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Example 1: Get a Run Command for VMSS VM instance

```powershell
Get-AzVmssVMRunCommand -ResourceGroupName MyRG0 -VMScaleSetName MyVMSS -InstanceId 0 -RunCommandName MyRunCommand
```

Get a Run Command for VMSS VM without Instance View.

### Example 2: Get a Run Command for VMSS VM instance with Instance View

```powershell
$x = Get-AzVmssVMRunCommand -ResourceGroupName MyRG0 -VMScaleSetName MyVMSS -InstanceId 0 -RunCommandName MyRunCommand -Expand InstanceView
$x.InstanceView
```

```output
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 VMSS 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

```powershell
Get-AzVmssVMRunCommand -ResourceGroupName MyRG -VMScaleSetName MyVMSS -InstanceId 1
```

Get list of all Run Commands for a VM.
41 changes: 35 additions & 6 deletions src/Compute/Compute/help/Get-AzVMRunCommand.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,48 @@ Gets specific run command for a subscription in a location.

## EXAMPLES

### Example 1: Get Run Command by Name
### Example 1: Get a Run Command for VM.

```powershell
Get-AzVMRunCommand -ResourceGroupName $rgname -VMName $vmname -RunCommandName "firstruncommand2"
Get-AzVMRunCommand -ResourceGroupName MyRG -VMName MyVM -RunCommandName MyRunCommand
```

Get Run Command by it's name.
Get a Run Command for VM without Instance View.

### Example 2: Get a Run Command for VM with Instance View

```powershell
$x = Get-AzVMRunCommand -ResourceGroupName MyRG -VMName MyVM -RunCommandName MyRunCommand -Expand InstanceView
$x.InstanceView
```

```output
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 VM

### Example 2: Get Run Commands by VM
```powershell
Get-AzVMRunCommand -ResourceGroupName $rgname -VMName $vmname
Get-AzVMRunCommand -ResourceGroupName MyRG -VMName MyVM
```

Get Run Commands by VM name
Get all Run Commands for a VM

## PARAMETERS

Expand Down
45 changes: 31 additions & 14 deletions src/Compute/Compute/help/Get-AzVmssVMRunCommand.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,48 @@ The operation to get the VMSS VM run command.

## EXAMPLES

### Example 1: Get RunCommand by name
### Example 1: Get a Run Command for VMSS VM instance

```powershell
Get-AzVmssVMRunCommand -InstanceId 3 -ResourceGroupName $rgname -RunCommandName "first" -VMScaleSetName $vmssname
Get-AzVmssVMRunCommand -ResourceGroupName MyRG0 -VMScaleSetName MyVMSS -InstanceId 0 -RunCommandName MyRunCommand
```

```output
Location Name Type
-------- ---- ----
eastus first Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands
```
Get a Run Command for VM without Instance View.

Get by runcommand name
### Example 2: Get a Run Command for VMSS VM instance with Instance View

### Example 2: Get RunCommand by Instance
```powershell
Get-AzVmssVMRunCommand -InstanceId 3 -ResourceGroupName $rgname -VMScaleSetName $vmssname
$x = Get-AzVmssVMRunCommand -ResourceGroupName MyRG0 -VMScaleSetName MyVMSS -InstanceId 0 -RunCommandName MyRunCommand -Expand InstanceView
$x.InstanceView
```

```output
Location Name Type
-------- ---- ----
eastus first Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands
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

```powershell
Get-AzVmssVMRunCommand -ResourceGroupName MyRG -VMScaleSetName MyVMSS -InstanceId 1
```

Get RunCommand by Instance
Get list of all Run Commands for a VM.

## PARAMETERS

Expand Down