Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I make sure that when user A tries to open a .doc(x) file, it will open in Word Viewer, and that when user B does the same it opens in Word 2013. The software is already installed on the system, I'm just wondering how to differentiate between the 2. Both users work remotely on RDS.

share|improve this question
Update, see again. – STTR Aug 19 '13 at 13:40
up vote 1 down vote accepted

Way 1, WSH vbscript, WMI query:


strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE (Name = ""winword.exe"" OR Name = ""WORDVIEW.EXE"") ")

Dim strInfo

Wscript.Echo  "Caption      ProcessId ParentProcessId SessionId ThreadCount UserName                            CommandLine"

For Each objProcess in colProcessList
    strInfo = objProcess.Caption
    strInfo = strInfo & "  " & objProcess.ProcessId
    strInfo = strInfo & "          " & objProcess.ParentProcessId
    strInfo = strInfo & "            " & objProcess.SessionId
    strInfo = strInfo & "          " & objProcess.ThreadCount
    objProcess.GetOwner strNameOfUser, strUserDomain
    strInfo = strInfo & "         " & strUserDomain & "\" & strNameOfUser
    strInfo = strInfo & "         " & objProcess.CommandLine
    Wscript.Echo strInfo


Caption      ProcessId ParentProcessId SessionId ThreadCount UserName                            CommandLine
WINWORD.EXE  10032          10480            0          7         HT\Administrator         "C:\App32\Microsoft Office\Office12\WINWORD.EXE"
WORDVIEW.EXE  17120          17800            0          4         HT\Administrator         "C:\App32\Microsoft Office\OFFICE11\WORDVIEW.EXE"

Get SessionId command line:

query user


>administrator         console             0  Active          .  13.08.2013 18:52

Way 2, tasklist, command line:

tasklist /FI "IMAGENAME eq WINWORD.EXE" /V /FO CSV | find /V /I "INFO:"
tasklist /FI "IMAGENAME eq WORDVIEW.EXE" /V /FO CSV | find /V /I "INFO:"

Way 3, Task Manager GUI:

Task Manager User Name, PID, SessionID

Way 4, command line, powershell:

powershell ps^|?{$_.Name -eq'WINWORD' -or $_.Name -eq'WORDVIEW'}^|FT MainWindowTitle,Path,Id,Name,SessionId -Au;query user

Way 5, powershell script:


$own=@{};gwmi win32_process|%{$own[$_.handle]=$_.getowner().user}
ps|?{$_.Name -eq 'WINWORD' -or $_.Name -eq 'WORDVIEW'}|FT MainWindowTitle,Path,SessionId,Name,Id,@{n="Owner";e={$own[$_.Id.ToString()]}} -Au
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .