List RDP Users

Forums Desktop Info List RDP Users

Tagged: 

Viewing 5 reply threads
  • Author
    Posts
    • #3293
      Brad

      I see in desktopinfo’s manual there is a RDS and RDSSESSIONS item but I’ve been playing around with both of them and I can’t seem to find a way to get either of them to output a list of users connected via RDP.

      What I am looking for is output similar to if you open task manager, and go to the users tab. So I want output like:

      ID User Status
      #1 bob connected
      #2 susan connected
      #3 jane disconnected
      #4 dick connected

      Where # is the RDP session ID number, bob/susan is the users username, and connected or disconnected is if they are connected or disconnected from RDP.

      The idea is that if we have multiple people working on the same box they may want to be aware of one another (in case two people are responding to a problem at the same time). It’s also useful to see who else is logged in if all the RDP sessions are taken up.

      Of course its possible to open task manager to find this information but it would be handy to have it viewable at all time in desktop info. I’ve managed to do this with bginfo but calling a VBS script.

      I can’t seem to figure out a way to make DesktopInfo call an external script nor can I figure out a WMI query that returns the desired information. Am I missing something?

      Thanks,
      Brad

    • #3296
      Brad

      We figured out how to do this.

      For other benefits, you can run powershell scripts with the CMD item.

      What we ended up with isn’t precisely what we wanted but it seems that column based output only looks decent if you use a monospace font (and I don’t care for the look of the monospace fonts with Desktop Info). Out of curiosity does Desktop Info not support font smoothing?

      Hopefully this helps someone else though:

      In DesktopInfo.ini:

      In rdp-users.ps1:
      $output = $(quser) -Replace ">",""
      $output = $output -Replace "\s{2,}","t"
      $($output.trim() | convertfrom-csv -delimiter "t" | ft -Property USERNAME -HideTableHeaders | Out-String).Trim()

      • #3299
        GlennGlenn
        Keymaster

        that script got mangled. can you repost it?

    • #3310
      Brad

      I saw that… unfortunately I don’t seem to be able to edit my post?

      I would post again but I think the issue is that the forum is interpreting the “backtick t” (which is a tab in powershell) as an indicator that I’m trying to post code.

      Is there some way to escape the backtick in the forum software?

    • #3314
      GlennGlenn
      Keymaster

      ok. yes, the backtick is a code block.

      if i type a backtick and some text followed by a backtick i get a code block

      \if i type backslash backtick what do i get ? \

      still creates a code block. i tried a couple of markdown plugins with no joy so i don’t know what the answer is apart from something obvious like manually inserting {backtick}

      • This reply was modified 1 year, 11 months ago by GlennGlenn.
    • #3338
      Brad

      $output = $(quser) -Replace “>”,””
      $output = $output -Replace “\s{2,}”,”{backtick}t”
      $($output.trim() | convertfrom-csv -delimiter “{backtick}” | ft -Property USERNAME -HideTableHeaders| Out-String).Trim()

      (Replace {backtick} with an actual backtick)

    • #3346
      GlennGlenn
      Keymaster

      Looks good. I found I had to change the double quotes to single quotes to get it to run in the ISE but it still complained about unauthorized access when running from DTI. But then I don’t claim to know anything about Powershell.

Viewing 5 reply threads
  • The topic ‘List RDP Users’ is closed to new replies.
Glenn's Page