Skip to content

Instantly share code, notes, and snippets.

@istairbn
Created November 9, 2015 13:17
Show Gist options
  • Save istairbn/5f9892143e6f6f5fec27 to your computer and use it in GitHub Desktop.
Save istairbn/5f9892143e6f6f5fec27 to your computer and use it in GitHub Desktop.
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
.Parameter Scheduler
Controls which scheduler is used. Assumes the default
.Parameter Destination
Where the JSON Output should be sent. Defaults to local file
.Parameter FetchServices
If True, will fetch service names as well. If false, will not.
.Parameter ServiceConfigLocation
If collecting the Services, the Service location on the scheduler. Set to the default.
.Example
.\Get-HPCData.ps1 -Scheduler HOSTNAME -Destination D:\MyDirectory\MyGrid\ClusterSettings.txt -FetchServices $True
.Notes
The prerequisite for running this script is the Microsoft HPC Server 2012 Client Utilities - It needs the Powershell Commands
.Link
www.excelian.com
#>
Param(
[CmdletBinding()]
[Parameter (Mandatory=$False)]
[string[]]
$Scheduler=$Env:CCP_SCHEDULER,
[Parameter (Mandatory=$False)]
[string]
$Destination=".\HPCClusterElements.txt",
[Parameter (Mandatory=$False)]
[bool]
$FetchServices=$True,
[Parameter (Mandatory=$False)]
[string]
$ServiceConfigLocation="HpcServiceRegistration"
)
Add-PSSnapin Microsoft.Hpc
Import-Module -name .\HPCServer_AutoScaleTools.psm1 -Force
Get-HPCClusterElements -Logging $False -Scheduler $Scheduler -FetchServices $FetchServices -ServiceConfigLocation $ServiceConfigLocation | ConvertTo-JSON | Out-File -FilePath $Destination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment