Skip to content

Commit

Permalink
content updates
Browse files Browse the repository at this point in the history
  • Loading branch information
martin77s committed Nov 3, 2019
1 parent e6d1a2f commit 0152d49
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Runbooks/StartStopVMsByTags.ps1
Expand Up @@ -5,7 +5,7 @@
,
[string]$SubscriptionNamePattern = 'maschvar.*' # '^SUB_DEV-.*|^SUB_SANDBOX-.*'
,
[boolean]$DryRun = $true
[boolean]$DryRun = $false
)

#region Login to Azure
Expand All @@ -31,6 +31,7 @@
$AzVmNightShift = $false
$AzVMCurrentTimeStamp = [datetime]::UtcNow
$AzVmActionRequired = $null
$AzVmDesiredState = -1
#endregion

#region Normalize PowerOn/Off tag values
Expand Down Expand Up @@ -65,15 +66,11 @@
} elseif ($AzVmPowerOn) {
if ($AzVmPowerOn -lt $AzVmCurrentTimeStamp) {
$AzVmDesiredState = 1
} else {
$AzVmDesiredState = 0
}

} elseif ($AzVmPowerOff) {
if ($AzVmPowerOff -lt $AzVmCurrentTimeStamp) {
$AzVmDesiredState = 0
} else {
$AzVmDesiredState = 1
}
}
#endregion
Expand Down Expand Up @@ -116,7 +113,8 @@
#endregion

#region Output the full details object
$output = New-Object -TypeName PSObject -Property @{
$output = [pscustomobject]@{
Separator = '----------------------------------------'
Name = $AzVm.Name
ResourceGroupName = $AzVm.ResourceGroupName
PowerState = $AzVm.PowerState
Expand All @@ -134,3 +132,4 @@
#endregion
}
}

0 comments on commit 0152d49

Please sign in to comment.