How to get current user name from process started using RunAs command with diffrent profile.

From: Marek Suski (None_at_none.pl)
Date: 02/07/05


Date: Mon, 7 Feb 2005 14:15:31 +0100

Hi all

How to get current user name (name of the user that logged on) from process that was started using "RunAs" command?

For example

User "MarkSmith" has started a VB application using RunAs command where user name was "Admin". Now VB app needs to copy some file to MarkSmith application data folder (C:\Documents and Settings\marksmith\Application Data\). I need to know how to get user name to do that. If I use %username% or WshMetwork.UserName I am getting "Admin" instead "MarkSmith".

Maybe I could read user name from registry?

Thank you for your help

Marek Suski



Relevant Pages

  • Re: Run As Pop Up
    ... David Candy's tip below helped me ... I edited my registry, rebooted and everything back to normal. ... and delete the default value (which will be runas). ... select the key command then double click in the other pane ...
    (microsoft.public.windowsxp.customize)
  • RunAs.exe Regini.exe
    ... I am attempting to make a change to a registry value via a logon ... I have the actual regini.exe command working perfectly, ... I am attempting to use the free RunAS ...
    (microsoft.public.windows.server.scripting)
  • Re: runas admin regedit change current user registry?
    ... command but only the Administrator's registry gets changed. ... Used runas and ran what? ... The "other" account will be found under HKU by SID. ...
    (microsoft.public.win2000.registry)
  • Re: cleanup after malware/trojan/virus
    ... See if Start, Run, COMMAND works - it probably will. ... When you get into the registry, ... Highlight the Drivers32 folder on the left and observe the contents ... Specifically open the exported file with a text editor. ...
    (microsoft.public.windowsxp.help_and_support)
  • reply
    ... >tried deleting it from the msconfig Startup tool system, ... neither the listed name or command line name ... First, ME comes with a registry backup application, try ... folder temporarily by using attrib.exe: ...
    (microsoft.public.security.virus)