Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - scripting schtasks

Reply
 
Old 02-10-2009   #1 (permalink)
arno


 
 

scripting schtasks

Hi,

Need some advice please. My problem in short:

How can I script a task to run under user/other credentials without
user intervention and without exposing the password through the
script?

In more detail:

I have a logon script that creates a Scheduled Task, once, at a random
time. The task itself consists of running a standalone vbs (let's call
it MyScript.vbs) file to be executed. MyScript.vbs itself works fine,
it compares and copies some files from a network server to the local
machine.

The task is created without problem, code goes something like this
(example is bogus code, but it works, this is not the problem)

oWSH.Run "schtasks.exe /create /tn MyTask /sc ONCE /st SomeTime /sd
SomeDate /tr x:\path\MyScript.vbs /ru SYSTEM"

The problem is that while the task is created fine, and upon further
inspection in the Task Scheduler looks fine to me, it does not get
executed. It will simply error saying "Could not start".

When I create this task using my own credentials, it will run fine. If
I create it to run as System, it will fail. So there's the error. I
need to somehow pass the users or other credentials to the task to be
created, but I would like not to expose the password in the logon
script that creates the task.

Any suggestions greatly appreciated,

tia,
arno






My System SpecsSystem Spec
Old 02-10-2009   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: scripting schtasks


"Al Dunbar" <alandrub@xxxxxx> wrote in message
news:uqXMj56iJHA.4868@xxxxxx
Quote:

>
> "arno" <rnospam_AT_xs4all_DOT_nl> wrote in message
> news:iae3p4hlfhg0n7rr07ljm9ogc7rveid3l1@xxxxxx
Quote:

>..snip
Quote:
Quote:

>> When I create this task using my own credentials, it will run fine. If
>> I create it to run as System, it will fail.
>
> This may be because the SYSTEM account lacks access to the network
> resources that the script is attempting to access.
>
If so, grant permissions to the computer object in Active Directory.
Quote:

>..snip
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 02-11-2009   #3 (permalink)
arno


 
 

Re: scripting schtasks

Al, Richard, tx for the input

arno

On Tue, 10 Feb 2009 16:21:47 -0600, "Richard Mueller [MVP]"
<rlmueller-nospam@xxxxxx> wrote:
Quote:

>
>"Al Dunbar" <alandrub@xxxxxx> wrote in message
>news:uqXMj56iJHA.4868@xxxxxx
Quote:

>>
>> "arno" <rnospam_AT_xs4all_DOT_nl> wrote in message
>> news:iae3p4hlfhg0n7rr07ljm9ogc7rveid3l1@xxxxxx
>
Quote:

>>..snip
>
Quote:
Quote:

>>> When I create this task using my own credentials, it will run fine. If
>>> I create it to run as System, it will fail.
>>
>> This may be because the SYSTEM account lacks access to the network
>> resources that the script is attempting to access.
>>
>
>If so, grant permissions to the computer object in Active Directory.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Schtasks.exe error Vista General
Cannot create run-once task with schtasks Vista General
Change tasks runtime using schtasks Vista General
Can't display or change a task with schtasks.exe Vista account administration
schtasks Does Not Run It When The Path of the Task Contains a Spac Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46