Re: Using wodSSH with PowerShell? - WeOnlyDo Discussion board

Re: Using wodSSH with PowerShell? (General questions)

by woddrazen, Tuesday, March 13, 2012, 21:45 (4638 days ago) @ Sean

Hi Sean,


Here is PowerShell example that will connect to server and execute ls -al command.
[code]$hostname = Read-Host Hostname
$login = Read-Host Login
$password = Read-Host Password

$ssh = New-Object -ComObject weOnlyDo.wodSSHCom.1

$ssh.Hostname = $hostname
$ssh.Login = $login
$ssh.Password = $password
$ssh.Blocking = 1
$ssh.Connect()

$ssh.DataReady = 0
$ssh.WaitFor( regex:[$ #>] $ )
$ssh.Execute( ls -al`r`n , regex:[$ #>] $ )
$ssh.Disconnect()[/code]
Let us know how it goes.


Regards,
Drazen


Complete thread: