Answers for "powershell ssh with password"

0

powershell ssh with password

$Password = "Password"
$User = "UserName"
$ComputerName = "Destination"
$Command = "SSH Command"

$secpasswd = ConvertTo-SecureString $Password -AsPlainText -Force
$Credentials = New-Object System.Management.Automation.PSCredential($User, $secpasswd)

$SessionID = New-SSHSession -ComputerName $ComputerName -Credential $Credentials #Connect Over SSH

Invoke-SSHCommand -Index $sessionid.sessionid -Command $Command # Invoke Command Over SSH
Posted by: Guest on February-12-2022

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language