Ok, this is driving me nuts...
Basically, I'm updating a CDP publication script so that it can SCP files
over to a Unix server. To do this, I'm using SharpSSH (got it working).
Anyhow… I need the script to wait, until the file transfer has completed
before moving on (for some reason the SCP objects Put and Get methods to not
wait). So… I figured because I'm using 2.0 CTP2 and the SCP object that I
create supports three different events. Why not use PSH Eventing…
So… I register an ObjectEvent as shown in the following code.
Register-ObjectEvent $scpClient OnTransferEnd -SourceIdentifier
Scp.OnTransferEnd -Action {$Global:Transferred $True}
However, while a PSEvent does get created, I never end up with a Global
variable named Transferred. Nor can I use the Wait-PsEvent cmdlet to wait
for this event to be created (that cmdlet never realizes that a
Scp.OnTransferEnd PSEvent was created for some reason). Is this a bug? Am I
going insane? What am I doing wrong…
Like I said, a PSEvent is created.


