Last active
August 29, 2015 14:21
-
-
Save istairbn/7a609e0e7dac4f25e803 to your computer and use it in GitHub Desktop.
Microsoft HPC Server 2012 - Set all your Azure nodes to Not-Deployed - Use as scheduled task at end of day to save money
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
$Logfile = "./"+$MyInvocation.MyCommand.Name+".log" | |
Function LogWrite | |
{ | |
Param ([string]$logstring) | |
$DATE = Get-Date -Format "yyyy/MM/dd HH:mm:ss zzz" | |
$LOG = $Date + ", " + $logstring | |
Add-content $Logfile -value $LOG | |
} | |
Add-PsSnapin Microsoft.HPC | |
$NODE = Get-HpcNode -GroupName AzureNodes -ErrorAction Stop | |
LogWrite "INFO, Setting AzureNodes to Offline, State:Transition" | |
Set-HpcNodeState -Node $NODE -State Offline -Confirm:$False -Force | |
LogWrite "INFO, Setting AzureNodes to NotDeployed, State:Transition" | |
Stop-HpcAzureNode -Node $NODE -Force $true | |
LogWrite "INFO, SUCCESS AzureNodes set to NotDeployed, State:Completion" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Logs it's actions to the directory - repoint them in line 1 if you have a central store