You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update Invoke-AzVMRunCommand.md with more Windows Examples (#23693)
* Update Invoke-AzVMRunCommand.md with more Windows Examples
Added more examples to educate Microsoft Learn readers on how to run cmdlets and script blocks using Invoke-AzVMRunCommand. This will help readers understand that the ScriptBlock parameter in PowerShell Invoke-Command cmdlet can also be worked around in Az PowerShell.
* Update Invoke-AzVMRunCommand.md
---------
Co-authored-by: Yunchi Wang <[email protected]>
Invoke a run command 'RunPowerShellScript' with overriding the script 'sample.ps1' on a Windows VM named 'vmname' in resource group 'rgname'. Var1 and var2 are defined as parameters in the sample.ps1. Parameter value can be string type only and script is responsible for converting them to other types if needed.
48
48
49
-
### Example 2: Invoke a command on Linux
49
+
### Example 2: Invoke a command on Windows - Using ScriptString parameter to execute cmdlet on the Windows VM
This command invokes a run command 'RunShellScript' that will execute the cmdlet Set-TimeZone with it's associated parameters. This example is useful when you want to execute short commands on Windows VM.
55
+
56
+
### Example 3: Invoke a command on Windows - Using ScriptString parameter to run script blocks on the Windows VM
This command invokes a run command 'RunShellScript' that executes a script block on a remote Windows VM named 'vmname'. The script block way allows you to execute multiple cmdlets with parameters in a single invoke and it also saves time on invoking multiple run commands for different cmdlets. Parameter value(s) can be of string type only.
73
+
74
+
### Example 4: Invoke a command on Linux
50
75
<!-- Skip: Output cannot be splitted from code -->
0 commit comments