Link to home
Start Free TrialLog in
Avatar of westone
westoneFlag for United States of America

asked on

Scheduled Tasks

Hi,
I was just browsing on my network, and I noticed that if I use Explorer to browse onto one of the workstations, and check the Windows/Tasks folder, the scheduled tasks that I know are there do not show up. Even if I use a command line to browse there, and use the Attrib *.* command, non of the tasks (*.job) files show up. I know the jobs are there, because I copied them there and used the "schtasks" command to set parameters and run them. If the jobs weren't there,  there would have been errors reported when I attempted to do this. What's up?
Avatar of Seth_zin
Seth_zin
Flag of United States of America image

When you ran the SCHTASKS you got a message saying "SUCCESS: The scheduled task..." etc right? And just to make sure the the /S (to set it up on a remote machine worked) check your local computer's tasks see if it made them in there instead.
Avatar of westone

ASKER

I used psexec to run the command on the remote stations. And it did result in a message that said Success when I updated the parameters for the tasks.

I checked that Hide Protected Operating system files was unchecked, and Show Hidden files was checked in Explorer, but that wasn't the problem.
Avatar of westone

ASKER

Oh, and also, if schtasks.exe is used to attempt to run or update a task that does not exists, it will state that no such task exists.
If you don't mind, can you paste the full command (without the U and P of course) you typed in to create the task? (including psexec). I want to try it the way you've done it and see if I can reproduce the issue on my end.
Avatar of westone

ASKER

I didn't use Schtasks to create the job, though it is possible. I just copied the job to the Tasks folder and then used Schtasks.exe to set the run credentials, other wise it wouldn't run since the Run As credentials do not get copied. But here are the 4 steps I used:

This first step copies the task file (A Disk Cleanup task) from the server to the Windows\Tasks folder of every workstation listed in the file "complist.txt":
FOR /f %%a in (complist.txt) do copy diskcln.job \\%%a\c$\windows\tasks\diskcln.job /y

The second step copies a .reg file containing Disk Cleanup Sage settings to the system path of each PC:
FOR /f %%a in (complist.txt) do copy cleanmgr.reg \\%%a\c$\windows\system32

This step runs the .reg file to apply the Sage settings on each computer:
FOR /f %%a in (complist.txt) do c:\windows\system32\pstools\psexec \\%%a regedit /s cleanmgr.reg

This last step applies the user credentials to be used to run the task. This is the step that would return a "No such Task exist" message if it did not find the job:
FOR /f %%a in (complist.txt) do c:\windows\system32\pstools\psexec \\%%a schtasks /change /tn diskcln /ru usernamehere /rp passwordhere
Avatar of westone

ASKER

Okay here is the issue, it is not completely resolved but I figured out what what the problem is: On the machine where I am not able to see the tasks in the task folder, the drive is formatted with a FAT32 file system. All the other machines where the Tasks show up normally, either from a command prompt or the explorer browser, are formatted as NTFS. But still, on the FAT32 drive, something is there somewhere because I can use schtasks.exe on the  command line and get successful results on tasks that do not show up in the directory. I do not think the tasks were actually running as scheduled, although there is really no way to tell one way or the other.
Sorry about not replying I couldn't figure out the issue. However, to test if the task is actually running as schedule just make a new one the same way but have the task do something you can check. Like create a batch file that outputs a file called successful.txt on the C drive or something similar that you can check the results (or check the log listed below). However, I would think that you would see it in the directory.

Can you also check the task scheduler on the local computer? Control Panel -> Scheduled Tasks are the tasks there? I don't have a FAT32 to try this out on so I can't try to emulate it here.

Also there is a log entry made every time a tasks runs. Go to the computer you wish to check. Open Scheduled Tasks, click Advanced (up by file edit view etc...) then click view log. Also, maybe they are hidden task for some reason, you can unhide tasks from the advanced menu. I'll let you know if I find out anything else.
Avatar of westone

ASKER

I did check the Scheduled Tasks folder of the local computer and no tasks showed up. The only reason I know something is there is the successful schtasks.exe commands. I did not check the logs but will. I don't expect to find anything, I don't see how a task could have been running.
I would double check that view hidden tasks is checked via the advanced menu. Like you said, it would have given an error if you used a /change command on a job that wasn't there. Also, you may have tried this, do a search via windows search to for *.job file on the whole C drive not just that one folder see if anything comes up. Grasping at straws here atm. Since it let you use /change maybe it's something as simple as hidden or in a different location. Very strange to say the least once you checked to see if the logs say it ran I will see what else I can find.
ASKER CERTIFIED SOLUTION
Avatar of Seth_zin
Seth_zin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial