Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

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

- - - - -

  • Please log in to reply
10 replies to this topic

#1
Outbreaker

Outbreaker

    Member

  • Member
  • PipPip
  • 298 posts
  • Joined 08-August 07
  • OS:Windows 7 x86
  • Country: Country Flag

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, 15 September 2014 - 01:07 AM.



How to remove advertisement from MSFN

#2
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,394 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Can you try to better describe the issue/question/requirements/restraints?

 

Wouldn't CPAU solve the problem (though differently)?

http://www.joeware.n.../cpau/index.htm

 

jaclaz



#3
Outbreaker

Outbreaker

    Member

  • Member
  • PipPip
  • 298 posts
  • Joined 08-August 07
  • OS:Windows 7 x86
  • Country: Country Flag

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, 15 September 2014 - 03:12 AM.


#4
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,394 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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.n...om_process.html

 

jaclaz 


Edited by jaclaz, 15 September 2014 - 03:28 AM.


#5
Outbreaker

Outbreaker

    Member

  • Member
  • PipPip
  • 298 posts
  • Joined 08-August 07
  • OS:Windows 7 x86
  • Country: Country Flag

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, 15 September 2014 - 07:45 AM.


#6
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,394 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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.cmd
Runfromprocess.exe Explorer.exe "cmd.exe /C" C:\batches\RFP\mytest.cmd
Runfromprocess.exe Winlogon.exe "cmd.exe /C" C:\batches\RFP\mytest.cmd

 



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

Resulting test.log:

MYCOMPUTER\myadmin

NT AUTHORITY\SYSTEM

 

 

jaclaz



#7
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,814 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

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

MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#8
Outbreaker

Outbreaker

    Member

  • Member
  • PipPip
  • 298 posts
  • Joined 08-August 07
  • OS:Windows 7 x86
  • Country: Country Flag

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, 15 September 2014 - 08:20 AM.


#9
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,394 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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.micro...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

#10
Outbreaker

Outbreaker

    Member

  • Member
  • PipPip
  • 298 posts
  • Joined 08-August 07
  • OS:Windows 7 x86
  • Country: Country Flag

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



#11
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,394 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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.ntlw...red-banana.html

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

jaclaz




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN