Created
September 21, 2013 10:56
-
-
Save mo6020/6649487 to your computer and use it in GitHub Desktop.
Shuts down controllers when UPS failure detected..
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
<# | |
.DESCRIPTION | |
To be run from UPS monitoring server via Windows NT triggers | |
.EXAMPLE | |
.\halt_on_power_fail.ps1 | |
.DATE | |
08-08-2013 | |
.VERSION | |
0.1 | |
.AUTHOR | |
Ed Morgan [ed.morgan@ansgroup.co.uk] | |
.VERSION CONTROL | |
0.1 - Initial commit | |
#> | |
$user = "root" | |
$rootpw = "password" | |
$pw = convertto-securestring $userpw -asplaintext -force | |
$credentials = new-object -typename system.management.automation.pscredential -argumentlist $user,$pw | |
$arrFilers = ("filer1", "filer2", "filer3", "filer4") | |
For Each ($filer in $arrFilers) { | |
# Debug line for testing | |
#Write-Output "Connecting to $filer: " | |
Connect-NaController $filer -credential $credentials -https | |
Invoke-NAssh -Command "cf disable" | |
Start-Sleep -s 5 | |
Invoke-NAssh -Command "halt" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment