Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a process that is running under the local system account on a Windows XP machine. This process then attempts to open a file with its default application as another user (say Max) on the system. Max is logged in and has a desktop.

The file is opened with the following command with ShellExecute in vbscript:

runas /user:Max "cmd.exe /C start \"path_to_file\""

After the process running under the local system account executed above, Max is prompted to enter his password. (So, the runas component clearly gets started at least.)

Only, even after entering the correct password, runas produces the following error:

RUNAS ERROR: Unable to run - cmd.exe /C start "path_to_file"
5: Access is denied.

I am not clear to what access is denied. Running cmd.exe /C start "path_to_file" as Max works perfectly fine. Max thus clearly has access to "path_to_file".

share|improve this question

2 Answers 2

I made a similar experience when I tried with the sanur tool which automatically enters the password. My script work fine as long as I used my account. when I ran it in SCCM which works with the systen account it failed.

I found no way around, my conclusion is that you can't start runas with the system account.

share|improve this answer
up vote 0 down vote accepted

This appears to be the same problem as encountered with PSExec. Edit: Runas and PSExec spawn new processes with different credentials by calling CreateProcessWithLogonW. However if you are using the "LocalSystem" account:

You cannot call CreateProcessWithLogonW from a process that is running under the "LocalSystem" account, because the function uses the logon SID in the caller token, and the token for the "LocalSystem" account does not contain this SID.

http://msdn.microsoft.com/en-us/library/ms682431%28VS.85%29.aspx

share|improve this answer
    
Could you please post the answer in more detail here and not link to a web page? –  Werner Henze Jun 7 '13 at 14:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.