Skip to content

Instantly share code, notes, and snippets.

@istairbn
istairbn / SetAzureNodesToOnline.ps1
Last active August 29, 2015 14:21
Microsoft HPC Server 2012 - Set all your Azure Nodes Online
$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
}
@istairbn
istairbn / SetAzureNodesToOffline.ps1
Last active August 29, 2015 14:21
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
}
@istairbn
istairbn / SetErrorNodesToOffline.ps1
Created May 19, 2015 11:32
Microsoft HPC Server 2012 - Set all your nodes in an Error state to Offline to avoid issues
Add-PsSnapin Microsoft.HPC
$NODE = Get-HpcNode -State Online -HealthState Error -GroupName ComputeNodes -ErrorAction Stop
Set-HpcNodeState -Node $NODE -State Offline -Force -Confirm:$False
@istairbn
istairbn / SetOfflineOKToOnline.ps1
Created May 19, 2015 11:34
Microsoft HPC Server 2012 - Set all Nodes that are Offline but functional to an Online State
Add-PsSnapin Microsoft.HPC
$NODE = Get-HpcNode -State Offline -HealthState OK -GroupName ComputeNodes -ErrorAction Stop
Set-HpcNodeState -Node $NODE -State Online -Confirm:$False
@istairbn
istairbn / Azure-GrowShrinkOnDemand.ps1
Created June 17, 2015 09:26
Automatically grow or shrink your HPCServer 2012 Azure Nodes - compatible with SOA sessions.
#------------------------------------------------------------------------------
#Script: Azure-GrowShrinkOnDemand.ps1
#Author: Benjamin Newton - Excelian - Code Adapted from AzureAutoGrowShrink.ps1
#Version 1.0.0
#Keywords: HPC,Azure Paas, Auto grow and Shrink, Calls
#Comments:This adaptation takes Call queue and Grid time into consideration
#-------------------------------------------------------------------------------
<#
.Synopsis
@istairbn
istairbn / PingIt.ps1
Last active August 29, 2015 14:26
A Powershell function that pings given host names and returns their status - basic machine monitoring
Function PingIt{
<#
.SYNOPSIS
Pings a list of computers, returns if they are offline or online and provides MS return time and status code
.FUNCTIONALITY
Simply used as a status indicator of machines as opposed to applications
.DESCRIPTION
Puts out the status of the hosts requested
@istairbn
istairbn / KeepItAuto.ps1
Created October 20, 2015 13:24
This Powershell script returns a Windows service to Automatic mode and restarts it if it was stopped
#------------------------------------------------------------------------------
#Script: KeepItAuto.ps1
#Author: Benjamin Newton - Excelian
#Version 1.0.0
#Keywords: DesiredState,Environment Management
#Comments:This script keeps services on Automatic and Alive!
#-------------------------------------------------------------------------------
<#
.Synopsis
@istairbn
istairbn / StringComparer.groovy
Last active October 21, 2015 09:40
Takes two strings, strips punctuation and to lower case, then checks to see if the underlying content is the same
String firstInput = args[0]
String cleanedComparison = args[1]
def StringCleaner(String input,String comparison){
input = input.toLowerCase().replaceAll("[^a-zA-Z ]", "").replaceAll("\\s","")
comparer = comparison.toLowerCase().replaceAll("[^a-zA-Z ]", "").replaceAll("\\s","")
def finder = (comparer =~ input)
assert finder
println finder
}
@istairbn
istairbn / Get-HPCData.ps1
Created November 9, 2015 13:17
HPC Server 2012 Powershell that collects all the Cluster Information and exports it to JSON
#------------------------------------------------------------------------------
#Script: Get-HPCData.ps1
#Author: Benjamin Newton - Excelian
#Version 1.0.0
#Keywords: HPC,Environment Management
#-------------------------------------------------------------------------------
<#
.Synopsis
This script
@istairbn
istairbn / OutputTester.groovy
Last active December 1, 2015 09:21
Groovy script for testing monitors - outputs specified logs lines on a schedule you can set.
//OutputTester.groovy - Used to output data at specific times. Useful for testing monitors
def counter = 0
outputLine = args.length > 0 ? args[0] : "App:LogscapeSmokeTest Counter:$counter The Service has successfully deployed"
while(1){
def timestamp = new Date().format ("yyyy-MM-dd HH:mm:ss,SSS")
def nowMins = new Date().format("mm").toInteger()
def nowSecs = new Date().format("ss").toInteger()
def nowMillis = new Date().format("SS").toInteger()