Re: Using wodSSH with PowerShell? - WeOnlyDo Discussion board

Re: Using wodSSH with PowerShell? (General questions)

by Sean, Tuesday, March 13, 2012, 21:48 (4636 days ago) @ woddrazen

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

Awesome - that is all I needed (this line here):

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

Thank you :) I think I can refer to your documentation for the rest. I didn't know how to get the ComObject loaded (or what it was called).

Thanks again.

Sean


Complete thread: