Welcome Forums General PowerShell Q&A Console Capture

Viewing 3 reply threads
  • Author
    Posts
    • #42902
      Participant
      Topics: 5
      Replies: 7
      Points: 1
      Rank: Member

      Hi Guys

      Not sure if this is possible but I am calling a vpn command line tool via:

      cmd /c ‘”C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client\vpncli.exe” -s > Login error.

      Is there anyway to capture this text and exit based upon >>Login error.?

      I can output this to a file but this process runs infinitum and I cant find away to read the file to search for the text and thus end the process.

      Is this even possible? Can you suggest any better way?

      Thanks

      Barry

    • #42906
      Keymaster
      Topics: 13
      Replies: 4872
      Points: 1,896
      Helping HandTeam Member
      Rank: Community Hero

      Generally,

      $x = [command]

      Will capture the command output, as text, in $x. You would then need to parse it once the command completes. However, if the command never completes… I’m not sure what you’d do.

    • #42942
      Participant
      Topics: 1
      Replies: 3
      Points: -19
      Rank: Member

      AnyConnect has its own Eventlog.
      Get-WinEvent -Logname ‘Cisco AnyConnect Secure Mobility Client’
      Maybe you can use an event in it to trigger some action when that Login error occurs.

    • #43032
      Participant
      Topics: 5
      Replies: 7
      Points: 1
      Rank: Member

      Hi Geir

      Many thanks for your excellent idea. I’ve been able to use that and now have a working solution.

      Many thanks

      Barry

Viewing 3 reply threads
  • The topic ‘Console Capture’ is closed to new replies.