Created
June 14, 2018 12:42
-
-
Save rbenigno/f01aa382bd9a4f93129c19d95557f2e5 to your computer and use it in GitHub Desktop.
Run commands over SSH using plink. Use when NetApp PowerShell Toolkit cannot be installed.
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
Set-ExecutionPolicy -Scope CurrentUser -Force:$True -ExecutionPolicy Unrestricted | |
$env:Path += ";C:\Scratch\Putty" | |
$clusters = Get-Content .\cluster_list.txt | |
if (!$cred) {$cred = Get-Credential} | |
$user = $cred.GetNetworkCredential().username | |
$pw = $cred.GetNetworkCredential().password | |
function ntap-cmd { | |
Param( | |
[Parameter(Mandatory = $true)] | |
[string]$Cluster, | |
[Parameter(Mandatory = $true)] | |
[string]$Cmd | |
) | |
write-host "############################################################" | |
write-host "# $Cluster `t $Cmd`n" | |
plink -l $user -pw $pw $Cluster $Cmd | |
} | |
function ntap-cmdall { | |
Param( | |
[Parameter(Mandatory = $true)] | |
[string]$Cmd | |
) | |
$clusters | %{ | |
ntap-cmd -Cluster $_ -Cmd "$Cmd" | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment