Scripting Question

RunAsCurrentUser (application not starting on remote system?)

05/15/2015 5227 views

I'm trying to use RunAsCurrentUser and psexec to start Outlook.exe on a remote system as the user that is currently logged in.

Here is what I've tried so far:

1. Downloaded RunAsCurrentUser from here: http://software.bigfix.com/download/bes/util/RunAsCurrentUser- (renamed it to RunAsCurrentUser.exe and copied it to C:\Downloads on the remote system)

2. Ran the following commands locally to try and start Outlook.exe on the remote system.

psexec \\SYSTEMNAME cmd

cd C:\Downloads

RunAsCurrentUser.exe "C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE"


However, Outlook.exe does not start on the remote machine.

Any ideas?

0 Comments   [ + ] Show comments


All Answers

Are you sure you have the correct path?  If it is a 64 bit machine then the path will be 
...\program files (x86)\.......
The other thought is how have you logged in psexec.exe?   You need to be logged in using a domain account if you want to be able to "see" users.
Answered 05/16/2015 by: EdT
Red Belt

  • The correct path for Outlook.exe? In general, I'm pretty sure "Program Files" is the 64 bit directory and "Program Files (x86)" is the 32 bit directory. But I checked, yes, and Outlook.exe is in the Office14 folder in "Program Files".

    Good point about using a domain account. I launched the command prompt logged in with a domain account, but didn't specify one when I ran psexec \\systemname cmd. Maybe that's the problem.

    The other thing is I'm not sure if RunAsCurrentUser is a standalone utility or if it can only be used with IBM's BigFix app. Any idea about that?
The reason I asked is that although 64 bit operating systems are pretty much the standard these days, most corporates, in my experience, still run the 32 bit install of Office as many add-ons are not 64 bit ready and there are other functional issues with bespoke office software that makes the 64 bit version less suitable. However, if you are running the 64 bit install of office then of course the path stated is correct.

As for "Run as Current User" - I am unfamiliar with this app, but how does it behave when there is more than one "current user".  I know from previous environments where they used vbscript and WMI to examine connections on workstations across the enterprise, that there were often multiple user connections to a machine.
Also, you don't appear to be passing the username and password of the current user to the utility. If it is run from psexec (logged in as local admin for example) then the current user is the local admin unless you provide credentials for a connection to be made as another user. Unless IBM have some back door in their code, then I cannot see how operating system security can be compromised to allow one user to impersonate another user with having the user login and password available.
If you want to be able to impersonate a user remotely, eg for support purposes, then why not use one of the remote access tools either as provided natively by the operating system or one of the many commercial solutions.
If you have another reason you need to start outlook remotely, why not share it with us as there may be an alternative solution to your requirement that is easier to implement.
Answered 05/16/2015 by: EdT
Red Belt

  • I'm just trying to install an Outlook plugin and wanted Outlook to restart as the current user that is logged in so I don't have to ask them to open it again. It's not a huge deal if I can't do it and need them to open Outlook, but I'm just curious how it would be done.

    What "remote access tools native to the OS" or "enterprise options" are you referring to?
    • ditto on the 32 64 bit thing for Office. The reason most people use, and Microsoft recommend the 32 bit office, is for add ins.
You could use mstsc to connect to the remote machine, for example, otherwise known as "Remote Desktop Connection" which is one of the apps under Accessories. Or google "PC remote access" for the various tools available.
I'm assuming the Outlook add-on is user-specific so why not install it via Active Setup?  That way it gets installed for the user during login when outlook is not started.
Answered 05/16/2015 by: EdT
Red Belt

  • Using RDP wouldn't let me impersonate them without the credentials right? I want an "on demand" deployment that restarts Outlook as them.
    • I don't think this is realistically achievable without a lot of work. Are the users so dumb that they cannot start Outlook on their own? Can the install not be configured to happen when the user logs in and before Outlook starts?
      • Obviously they can start Outlook on their own, and yeah it probably could be configured to install at logon. That's not what I'm trying to do though :)

        I thought this was interesting, but I'm not sure if another app is needed to use it:

Have you tried googling on "runascurrentuser" - it leads to a number of discussions which may help you. I presume you have tried entering the full paths wherever you try to run an EXE as you cannot rely on paths when running as the local system account as it does not have a profile.

I have also remembered another factor that may be causing your issues if you are running on Win 7 or later.  On WinXP, you could use the AT scheduler to open a CMD window running in system context and able to interact with the desktop. This is no longer possible in Win 7 as USERS run in a different context to system accounts and services. Interaction with Desktop is no longer supported and even if you force it, it causes a UAC prompt to open.
Since your RunAsCurrentUser utility is being started in Session 0, it cannot contact any user sessions and therefore probably just errors out and exits.  

What you might want to try is to redirect output from RunAsCurrentUser.exe to a text file, eg, add the string:  >C:\temp\logfile.txt   to the end of your current command string, then have a look at the logfile hopefully created to see what the execution outcome was.
Answered 05/18/2015 by: EdT
Red Belt

  • Thanks for the help. I can't even get the utility to work locally on calc.exe, so I think you might need IBMs "BigFix" app to use it. Anyway, I think I'm gonna give up on this and just have the user restart Outlook. Thanks for your help.

What is the add in?Normally you put an outlook add in down, and its registered with the system so its picked up on the first relaunch of Outlook. This add in definitely works with the version (64bit) of office you have??

Could you not use a scheduled task to run as the logged in user (you might need to know the username), your other problem would be what if outlook is running so you would have to kill it, then relaunch it.

I look forward to hearing the solution on this.


Answered 05/19/2015 by: Badger
Red Belt

  • The add in is a Barracuda Spam Filter plugin. It just adds a button to classify things as spam. Yes, it definitely works with x86/x64 versions of office, as they have both x86 and x64 versions available.

    "Could you not use a scheduled task to run as the logged in user (you might need to know the username), your other problem would be what if outlook is running so you would have to kill it, then relaunch it."

    This IS precisely the problem :) I want to: 1) kill outlook.exe 2) install the plugin, 3) restart Outlook.exe (as the currently logged on user).

    The problem is that all the ways I know of restarting Outlook.exe will start it as MY user, not the user that is currently logged into the system.

    Not sure how I would use a scheduled task to accomplish step 3, unless I knew the users username/password and had the task run under their account.
    • if you are going to just kill outlook, leave it dead, as soon as they can they will launch it again. You really should be 'polite' and ask them to close outlook for the install. my problem with that is, no one reads the pop ups. So killing Outlook should work. install the plug in, then when they restart outlook (as themselves) your should be home and hosed.
      • I just need to make sure to ask them to wait 30-45 seconds so the plugin has time to install.

        And I was trying to be "polite" by taking care of shutting Outlook down for them (I would ask them if it's ok first, of course) :)
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ