Skip to content

Instantly share code, notes, and snippets.

@kozo
Last active December 22, 2015 06:49
Show Gist options
  • Save kozo/6433745 to your computer and use it in GitHub Desktop.
Save kozo/6433745 to your computer and use it in GitHub Desktop.
powershellとputtyで複数のサーバにログイン
$user = "Login User Name"
$exePath = "putty exe Path"
$inputFilePath = "Server List Text FilePath"
$sr = New-Object System.IO.StreamReader($inputFilePath, [Text.Encoding]::GetEncoding("Shift_Jis"))
while (($line = $sr.ReadLine()) -ne $null)
{
$arg = "-ssh " + $line + " -l " + $user
Start-Process $exePath -ArgumentList $arg
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment