Skip to content

Instantly share code, notes, and snippets.

@istairbn
Last active August 29, 2015 14:21
Show Gist options
  • Save istairbn/7a609e0e7dac4f25e803 to your computer and use it in GitHub Desktop.
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
$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"
@istairbn
Copy link
Author

Logs it's actions to the directory - repoint them in line 1 if you have a central store

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment