Jump to content

Run a script with SYSTEM and execute an file with Current User?


Recommended Posts

HI,

I like to make a Schedule Task on Windows XP that would run without the need to enter a password. The only solution for this would be to run the task with the SYSTEM account but this won't allow me to execute an .exe file (interactive processes).

Is it  possible to make a .cmd or .vbs script that would run with the SYSTEM acccount but would execute an .exe file with the Current User account?

Edited by Outbreaker
Link to comment
Share on other sites


In Windows XP you can create a Task that automatically runs a file with the SYSTEM user this way no password is required. But when running the Task as SYSTEM then it will not run any interactive processes.

So i try to find a way to overcome this problem, The only idea i had was to use a script that would sit in the middle and would then be run by the Task with the SYSTEM user and the script would then execute an .exe file as the Current Login User without the need to enter the user account password. ;)

Edited by Outbreaker
Link to comment
Share on other sites

Yep, but you are still describing your proposed way to reach your goal, as opposed to describing your actual goal, which - if I get this right - can be reached through other ways.

 

The real issue with RunAs is that you have to provide a password, and to provide it in "clear text", CPAU uses an encrypted one.

 

There is however an "interactive" switch to the AT command:

http://ss64.com/nt/at.html

and the SCHTASKS has the /IT /RU switches:

http://ss64.com/nt/schtasks.html

 

So, unless you provide a "real world" detailed example, I have - as said - difficulties in understanding what you mean.

 

Or, you want something *like* :unsure::

http://www.nirsoft.net/utils/run_from_process.html

 

jaclaz 

Edited by jaclaz
Link to comment
Share on other sites

Unfortunately the tool "RunFromProcess" is not compatible with Windwos XP. Here is what i exactly try to do:

I want to execute the command ("%ProgramFiles%\K-Lite Codec Pack\Tools\CodecTweakTool.exe" /verysilent /update /freq=7) every 2 days, but i can't do this in the Windwos XP Scheduled Task because this wont work when i run it a SYSTEM user.

An alternative i tried was this Scheduled Task command:

SCHTASKS /Create /RU "SYSTEM" /SC DAILY /MO 7 /TN "K-Lite Codec Pack Update Checker" /TR "REG ADD \"HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce\" /v \"K-Lite Codec Pack Update Checker\" /t REG_EXPAND_SZ /d \"\\"\""%\"ProgramFiles\"%\K-Lite Codec Pack\Tools\CodecTweakTool.exe\\"\"" /verysilent /update /freq=7\" /f"

This will add a registry entry to the RunOnce key so that this command above would be only once executed after a Admin login. But unfortunately this doesn't work with a Dial Up connection or when manually login into a modem because this comment will be then executed before an internet connection could be established. :(

So i'm trying now to find another way to fix this problem. :}

Edited by Outbreaker
Link to comment
Share on other sites

Are you really sure that RunFromProcess is "not compatible" with WIndows XP? :w00t:
 
But I am still failing to understand the previous reference to "interactive" nor (sorry, maybe I have one of those dumb days) what exactly is the problem.
 
You want to run that CodecTweakTool.exe command when you are logged in as Admin, BUT the command needs to be executed as SYSTEM?
 
On my XP these works fine:
 

@ECHO OFF::Runasprocess.cmdRunfromprocess.exe Explorer.exe "cmd.exe /C" C:\batches\RFP\mytest.cmdRunfromprocess.exe Winlogon.exe "cmd.exe /C" C:\batches\RFP\mytest.cmd

 

@ECHO OFF:mytest.cmdwhoami >>c:\batches\RFP\test.log

Resulting test.log:

MYCOMPUTER\myadmin

NT AUTHORITY\SYSTEM

 

 

jaclaz

Link to comment
Share on other sites

But I am still failing to understand the previous reference to "interactive" nor (sorry, maybe I have one of those dumb days) what exactly is the problem.

The interactive desktop, I think, is more of a recent term. Where in Vista and newer OSes, the interactive desktop resides in Session 1 (or higher number) and the System account and services run in Session 0. For XP, everything would run in Session 0 (as it was interactive) unless another account was logged in, either via RDP or Fast User Switching.

I'm wondering why you want to use the System account, why not the logged in user account? Schtasks allows for password input with the /rp switch.

 

c:\windows\system32\schtasks /create /sc MONTHLY /MO first /D MON /st 07:00:00 /TN rights /tr c:\PROGRAM.exe /ru COMPUTERNAME\USERNAME /rp PASSWORD
Link to comment
Share on other sites

Oh okay now it works :thumbup i didn't know i had to also include "cmd.exe /C". :huh:

@Tripredacus

It's for a Unattended Setup so this wouldn't work if a user changes his password or deletes the user profile. ;)

Edited by Outbreaker
Link to comment
Share on other sites

The interactive desktop, I think, is more of a recent term. Where in Vista and newer OSes, the interactive desktop resides in Session 1 (or higher number) and the System account and services run in Session 0. For XP, everything would run in Session 0 (as it was interactive) unless another account was logged in, either via RDP or Fast User Switching.

Well, in my simplicity, and relatively to the context, the "interactive" is the same since AT on NT Windows systems was invented:

http://ss64.com/nt/at.html

http://support.microsoft.com/kb/121562/en-us

Schtasks allows for password input with the /rp switch.

 

One of the common issues with passwords of an Admin use in AT or SCHTASKS, is that the password is in clear text, hence it is not something I would personally "leave around" in my PC's, hence the suggestion for CPAU.

 

@Outbreaker 

Good. :)

 

jaclaz

Link to comment
Share on other sites

Thank you for the help was looking 2 days for a solution for this. :crazy:

You are welcome :).

Most probably you were slipping on a chocolate covered banana (or fell in the XYZ fallacy):

http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/put-down-the-chocolate-covered-banana.html

Sometimes it is important to ask the right question, in order to get the right answer ;).

jaclaz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...