Jump to content

Schtasks' create vs. change


Recommended Posts

Guest Mr Troy
Posted

I have a task that needs to be run from time to time on twenty servers. The

tasks are setup to run "once."

 

I'd like to use schtasks to automate the tasks. The wall I'm hitting is

that you cannot change a run "once" task. I've tried changing the task to

run monthly, but then, even if I set the st,sd,ed, nothing happens.

 

My "Change:"

schtasks /change /tn "Auto Shutdown" /s dcmember1 /st 14:50:00 /sd

01/16/2008 /ed 01/17/2008 /enable

 

Anyone have any ideas on how to get around that? To try and get around it,

I thought, hey I'll use "Create" and have it delete the file. I think that

would work, but is there a way to kick it out to a log file rather than

viewing event viewer to make sure the task ran?

 

My "Create:"

schtasks /create /s dcmember1 /u dcnugget\administrator /p password /sc once

/tn "Auto Shutdown3" /tr "c:\support\pstools\psshutdown.exe -l -r" /st 16:08

/z

 

Thank you for any help you can offer

  • Replies 5
  • Created
  • Last Reply
Guest Pegasus \(MVP\)
Posted

Re: Schtasks' create vs. change

 

 

"Mr Troy" <MrTroy@discussions.microsoft.com> wrote in message

news:62713093-18EA-44EB-A97F-7D99C82E6F0C@microsoft.com...

>I have a task that needs to be run from time to time on twenty servers.

>The

> tasks are setup to run "once."

>

> I'd like to use schtasks to automate the tasks. The wall I'm hitting is

> that you cannot change a run "once" task. I've tried changing the task to

> run monthly, but then, even if I set the st,sd,ed, nothing happens.

>

> My "Change:"

> schtasks /change /tn "Auto Shutdown" /s dcmember1 /st 14:50:00 /sd

> 01/16/2008 /ed 01/17/2008 /enable

>

> Anyone have any ideas on how to get around that? To try and get around

> it,

> I thought, hey I'll use "Create" and have it delete the file. I think

> that

> would work, but is there a way to kick it out to a log file rather than

> viewing event viewer to make sure the task ran?

>

> My "Create:"

> schtasks /create /s dcmember1 /u dcnugget\administrator /p password /sc

> once

> /tn "Auto Shutdown3" /tr "c:\support\pstools\psshutdown.exe -l -r" /st

> 16:08

> /z

>

> Thank you for any help you can offer

 

Delete and recreate sounds fine.

 

You can examine the file c:\Windows\SchedLgU.txt to ensure that

the recreated task ran.

Guest Mr Troy
Posted

Re: Schtasks' create vs. change

 

"Pegasus (MVP)" wrote:

 

You can examine the file c:\Windows\SchedLgU.txt to ensure that

> the recreated task ran.

>

Hey Pegasus,

 

I can view the SchedLgU.txt from 'Advanced' in the menu bar, but cannot seem

to find it on the Windows 2003 SP1 machines c:\windows location. Ever seen

that before? Doesn't matter if I do a search...all files are viewable.

 

Once again, thank you for any help you can offer!

 

Mr Troy

Guest Pegasus \(MVP\)
Posted

Re: Schtasks' create vs. change

 

 

"Mr Troy" <MrTroy@discussions.microsoft.com> wrote in message

news:4D111D9F-002E-4D5A-A7C1-09F9E994C3F6@microsoft.com...

> "Pegasus (MVP)" wrote:

>

> You can examine the file c:\Windows\SchedLgU.txt to ensure that

>> the recreated task ran.

>>

> Hey Pegasus,

>

> I can view the SchedLgU.txt from 'Advanced' in the menu bar, but cannot

> seem

> to find it on the Windows 2003 SP1 machines c:\windows location. Ever

> seen

> that before? Doesn't matter if I do a search...all files are viewable.

>

> Once again, thank you for any help you can offer!

>

> Mr Troy

 

It's clearly visible on my machine:

C:\WINDOWS>attrib sch*.txt

A C:\WINDOWS\SchedLgU.Txt

 

In a few hours I'll have a look at a Windows 2003 machine. I'd be

very surprised if I could not find it there in exactly the same place!

Guest Mr Troy
Posted

Re: Schtasks' create vs. change

 

 

 

"Pegasus (MVP)" wrote:

>

> "Mr Troy" <MrTroy@discussions.microsoft.com> wrote in message

> news:4D111D9F-002E-4D5A-A7C1-09F9E994C3F6@microsoft.com...

> > "Pegasus (MVP)" wrote:

> >

> > You can examine the file c:\Windows\SchedLgU.txt to ensure that

> >> the recreated task ran.

> >>

> > Hey Pegasus,

> >

> > I can view the SchedLgU.txt from 'Advanced' in the menu bar, but cannot

> > seem

> > to find it on the Windows 2003 SP1 machines c:\windows location. Ever

> > seen

> > that before? Doesn't matter if I do a search...all files are viewable.

> >

> > Once again, thank you for any help you can offer!

> >

> > Mr Troy

>

> It's clearly visible on my machine:

> C:\WINDOWS>attrib sch*.txt

> A C:\WINDOWS\SchedLgU.Txt

>

> In a few hours I'll have a look at a Windows 2003 machine. I'd be

> very surprised if I could not find it there in exactly the same place!

>

Pegasus-you ROCK! I totally spaced the attrib. Doh! Thank you for

everything!

Guest Pegasus \(MVP\)
Posted

Re: Schtasks' create vs. change

 

 

"Mr Troy" <MrTroy@discussions.microsoft.com> wrote in message

news:8DDB99CD-13EA-4DE2-B0BF-EF2B788F9EB5@microsoft.com...

>

>

> "Pegasus (MVP)" wrote:

>

>>

>> "Mr Troy" <MrTroy@discussions.microsoft.com> wrote in message

>> news:4D111D9F-002E-4D5A-A7C1-09F9E994C3F6@microsoft.com...

>> > "Pegasus (MVP)" wrote:

>> >

>> > You can examine the file c:\Windows\SchedLgU.txt to ensure that

>> >> the recreated task ran.

>> >>

>> > Hey Pegasus,

>> >

>> > I can view the SchedLgU.txt from 'Advanced' in the menu bar, but cannot

>> > seem

>> > to find it on the Windows 2003 SP1 machines c:\windows location. Ever

>> > seen

>> > that before? Doesn't matter if I do a search...all files are viewable.

>> >

>> > Once again, thank you for any help you can offer!

>> >

>> > Mr Troy

>>

>> It's clearly visible on my machine:

>> C:\WINDOWS>attrib sch*.txt

>> A C:\WINDOWS\SchedLgU.Txt

>>

>> In a few hours I'll have a look at a Windows 2003 machine. I'd be

>> very surprised if I could not find it there in exactly the same place!

>>

> Pegasus-you ROCK! I totally spaced the attrib. Doh! Thank you for

> everything!

 

Thanks for the feedback. GUIs are fine for end users but when it

comes to some performing investigative work, Command Line tools

are often far more powerful and revealing. I assume you used Windows

Explorer to look for the file, getting it to "Show all files" - yet you

could

not see it. Here are three commands that would have shown it immediately:

- attrib.exe

- dir /ah

- notepad c:\windows\schedlgu.txt


×
×
  • Create New...