Re: Using wodSSH with PowerShell? - WeOnlyDo Discussion board

Re: Using wodSSH with PowerShell? (General questions)

by Sean, Tuesday, March 13, 2012, 22:34 (4435 days ago) @ woddrazen

Sean,


Can you show us maybe your code snippet?


Drazen

$hostname = esxi-01.noobs.local
$login = root
$password = mypassgoeshere

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

$ssh.Hostname = $hostname
$ssh.Login = $login
$ssh.Password = $password
$ssh.Blocking = 1
$ssh.Port = 22
$ssh.Timeout = 25
$ssh.Connect()

$ssh.DataReady = 0
$ssh.WaitFor( regex:[$ #>] $ )
$ssh.Execute( df -h`r`n , regex:[$ #>] $ )
$ssh.Disconnect()

Normally, when I SSH on in PuTTy my shell gives me the prompt: ~ #

So I guess that $ssh.WaitFor( regex:[$ #>] $ ) is waiting for the shell with a variety of options including #? Once it sees this it then continues on to the $ssh.execute part? Is the regex check on the end of the $ssh.Execute do? Does it also wait for the shell prompt ~ # before continuing?

Sean


Complete thread: