SSH w powershell

27 March 2015

$IP="192.168.1.1"

$credS ="secretpasswordby" # $password = "mypassword" | ConvertTo-SecureString -asPlainText -Force | ConvertFrom-SecureString

$credN = "uzytkownik"

 

$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $credN ,($credS | ConvertTo-SecureString)

New-SSHSession -ComputerName $IP -Credential ($cred)

Invoke-SSHCommand -Index 0 -Command "#bash command"

Kategorie: Power Shell