2

In past jobs I've used a lot of runas /user:.. in order to allow quick access between multiple accounts while logged in as a primary account. Both server side or and on workstations. We're looking at situations where sometimes a user might have multiple copies of the same application open under different multiple user contexts.

As such it would be extremely useful to have some kind of visual queue to differentiate based on the launching user.

In the past I always would just change the CMD prompt background colors. Here I need it for GUI applications. It looks like changes to the color scheme on Windows 7 / 2008 r2 read from the currently logged in user, not from that specific user's profile. That seems to invalidate my first choice.

What are my options?

Note: I did think about asking this on SU not here.. Didn't think there would be many cases of people running applications under half a dozen different accounts from one active session.

Tim Brigham
  • 15,545
  • 10
  • 75
  • 115
  • 1
    This is an interesting question. Short of looking in Task Manager and seeing what user the task is running under, I don't know of any way offhand. I run into this too from time to time, but it is mostly on server consoles, so the user is either my account or the domain admin account. I wonder if there is a desktop widget that would do this? – MikeAWood Aug 09 '13 at 12:39
  • @MikeAWood a little scripting proved to be my solution. :) Thought you might want to see. – Tim Brigham Aug 09 '13 at 16:25
  • 1
    Very nice workaround... – MikeAWood Aug 12 '13 at 19:29

1 Answers1

2

I did find a way to address this via AutoIt. It isn't perfect but I can get most of my windows labeled. My users can launch this and have it run in the background as needed.

#Include <Array.au3>
#include <WinAPIEx.au3>
While ( True ) 
    Sleep( 100 )
    Local $PID = 0
    Do
        $handle = WinGetHandle("[ACTIVE]", "") 
        $iPID = WinGetProcess($handle)
    Until $iPID > 0
    Local $aUser = _WinAPI_GetProcessUser($PID)
    $UserName=$aUser[0]
    $title = WinGetTitle ( $handle )
    $result = StringInStr($title, "Owned By")

    If ( $Result == 0 ) Then
        WinSetTitle($handle, "", $title & " - Owned By " & $UserName)
        $title = WinGetTitle ( $handle )
    EndIf  
WEnd
Tim Brigham
  • 15,545
  • 10
  • 75
  • 115