Re: Using wodSSH with PowerShell? - WeOnlyDo Discussion board

Re: Using wodSSH with PowerShell? (General questions)

by Sean, Wednesday, March 14, 2012, 22:32 (4434 days ago) @ Sean

Sean,


You need to use only username inside Login Property. What happens if you run our VBS sample inside samples folder.

Does it work maybe there?


Drazen

Thanks Drazen,

I'll give the VB sample a try now as I have VS Express installed.

Thought that was the case. Ok tried out a VBS sample and it worked perfectly - connected straight away to the exact same host I was testing the PowerShell code on. PowerShell is now working too though. I noticed that the VBS sample had this:

ssh.Protocol = 4

so in my PoSH one, I added:

$ssh.Protocol = 4

and it now gets further and manages the Connect() method this time. It also returns what I was after (a SHA1 fingerprint from my host), but it still throws back an error on the WaitFor part. See this error:

PowerCLI C:Program Files (x86)VMwareInfrastructurevSphere PowerCLI> $ssh.WaitFor( regex:[$ #>] $ )
Exception calling WaitFor with 1 argument(s): The current connection has timeout.
At line:1 char:13
+ $ssh.WaitFor <<<< ( regex:[$ #>] $ )
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation

Any ideas on that? I am guessing it is not getting what it wants in the regex pattern whilst waiting? When I connect via SSH to this host normally I get this (see this screenshot for the error I was talking about above too): http://dl.dropbox.com/u/450727/Temp/wodSSHexample.jpg


Complete thread: