Created
January 14, 2015 11:16
-
-
Save kerslake/d1b49f979a07802c4967 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workflow Start-VM | |
{ | |
Param ( | |
[parameter(Mandatory=$true)] | |
[String] | |
$VMName, | |
[parameter(Mandatory=$true)] | |
[String] | |
$ServiceName | |
) | |
$day = (Get-Date).DayOfWeek | |
if ($day -eq 'Saturday' -or $day -eq 'Sunday'){ | |
exit | |
} | |
$subscriptionName = Get-AutomationVariable -Name "SubscriptionName" | |
$subscriptionID = Get-AutomationVariable -Name "SubscriptionID" | |
$certificateName = Get-AutomationVariable -Name "CertificateName" | |
$certificate = Get-AutomationCertificate -Name $certificateName | |
Set-AzureSubscription -SubscriptionName $subscriptionName -SubscriptionId $subscriptionID -Certificate $certificate | |
Select-AzureSubscription $subscriptionName | |
Start-AzureVM -Name $VMName -ServiceName $ServiceName | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment