Windows Vista Forums

Register-ObjectEvent Question
  1. #1


    Tyson Guest

    Register-ObjectEvent Question

    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.



      My System SpecsSystem Spec

  2. #2


    Tyson Guest

    RE: Register-ObjectEvent Question

    Come on help a brother out! Can someone from the product team please
    comment. If not... I fully intend bringing this scenarioup in the next
    feedback cycle.

    T

    "Tyson" wrote:

    > 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.

      My System SpecsSystem Spec

Register-ObjectEvent Question problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Register-ObjectEvent to receive remote jobs Cosmin Ilie PowerShell 1 12 Jan 2010
Register-ObjectEvent CTP3 Doug PowerShell 0 23 Dec 2008
Register key for SLI sriadad Vista Games 2 11 Nov 2008
do I have to re-register If---- t-4-2 Vista General 32 10 May 2008
Cannot Re-Register in DNS Or Tsemah Vista networking & sharing 0 22 Apr 2007