Skip to content

Commit 39593b4

Browse files
committed
updated powershell sample code
1 parent f2354e7 commit 39593b4

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

articles/automation/learn/automation-tutorial-runbook-graphical.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: This article teaches you to create, test, and publish a simple grap
44
keywords: runbook, runbook template, runbook automation, azure runbook
55
services: automation
66
ms.subservice: process-automation
7-
ms.date: 04/19/2020
7+
ms.date: 09/15/2020
88
ms.topic: tutorial
99
---
1010
# Tutorial: Create a graphical runbook
@@ -297,16 +297,17 @@ You can now modify the runbook so that it only attempts to start the VM if it is
297297

298298
15. Paste the following code snippet into the editor page.
299299

300-
```powershell-interactive
301-
$StatusesJson = $ActivityOutput['Get-AzVM'].StatusesText
302-
$Statuses = ConvertFrom-Json $StatusesJson
303-
$StatusOut =""
304-
foreach ($Status in $Statuses){
305-
if($Status.Code -eq "Powerstate/running"){$StatusOut = "running"}
306-
elseif ($Status.Code -eq "Powerstate/deallocated") {$StatusOut = "stopped"}
307-
}
308-
$StatusOut
309-
```
300+
```powershell
301+
$Statuses = $ActivityOutput['Get-AzVM'].Statuses
302+
$StatusOut = ""
303+
foreach ($Status in $Statuses) {
304+
if($Status.Code -eq "Powerstate/running")
305+
{$StatusOut = "running"}
306+
elseif ($Status.Code -eq "Powerstate/deallocated")
307+
{$StatusOut = "stopped"}
308+
}
309+
$StatusOut
310+
```
310311
311312
16. Create a link from `Get Status` to `Start-AzVM`.
312313

0 commit comments

Comments
 (0)