Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Scheduling task using AT not working

Posted on 2002-05-23
9
Medium Priority
?
214 Views
Last Modified: 2010-04-13
I'm trying to schedule a task using AT.  The command is as follows:

at 16:00 cmd /c \"reg query "HKCU\SOFTWARE\Microsoft\Internet Explorer\T
ypedURLs" >> log.txt\"

If I just type the reg query command on the command line, it pipes the output fine to the log.txt file.  But as soon as I put it in an AT command, all I get in the log.txt file is:
"The system was unable to find the specified registry key."

I next tried creating a batch file with the reg query command in it and used the at command as follows:

at 16:00 cmd /c c:\temp\log.bat

That once again gave the same output in the log.txt file.  If I run the log.bat from the command line, it gives me the output I'm looking for in log.txt.

I tried adding some pause commands to the log.bat file when the AT utility ran it to see what was happening and nothing appeared wrong.  So I'm not sure what is wrong.

Any ideas?  Oh, and I don't want to use scheduled tasks either.  Prefer to use AT.

Shane
0
Comment
Question by:SigTau66
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 41

Expert Comment

by:stevenlewis
ID: 7031011
I think it is a permission issue
with scheduled tasks you can specify the username and password
http://support.microsoft.com/search/preview.aspx?scid=kb;en-us;Q300160
you can try incorperating the runas command in the bat file
0
 
LVL 41

Expert Comment

by:stevenlewis
ID: 7031015
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 7031076
try using  
cmd.exe /k for interactive batch files.

I hope this helps !
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
LVL 14

Accepted Solution

by:
AvonWyss earned 800 total points
ID: 7031284
By default, jobs created by AT run in the system context. THe system context, however, will have virtually no registry keys in the HKEY_CURRENT_USER branch. So, what you can do, it to open Control Panel, go to the Sheduled Tasks, and modify that task you have created using AT to use the user you want to run.

Note that you will probably not be able to export that registry key from *any* currently logged in user, but only for the user you defined in the task properties. If that's fine with you, go for it.
0
 
LVL 7

Expert Comment

by:franka
ID: 7032096
have you tried the "interactive" switch?

it lets the task run in the context of the logged on user.


at 16:00 cmd.exe /interactive /c \"reg query "HKCU\SOFTWARE\Microsoft\Internet Explorer\T
ypedURLs" >> log.txt\"
0
 

Author Comment

by:SigTau66
ID: 7032445
Steven:  I had already looked at those MS articles and still couldn't figure it out.  Thanks for taking your time to submit an answer.

SysExpert & Franka:  Already did the /k command and it still didn't work along with the interactive switch.  And I'm trying to make this as hidden as possible so the person doesn't know they're having their browser history watched.

The correct and accepted answer was by AvonWyss.  The 3-4 hours I spent researching this problem, I don't know how many times I read about the AT command running in the system context and never thought that it wouldn't have permission to read that registry key.  I submitted the same scheduled command as yesterday, but this time I went to that task in Scheduled Tasks and had it runas the administrator on the machine and it worked perfectly.  

I appreciate all the help from everybody.

Shane
0
 
LVL 7

Expert Comment

by:franka
ID: 7032706
now you don't need the /interactive switch?
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 7033391
Shane, thank you for accepting my answer. However, from your comment, I am not sure whether you may still be missing a part of your "quest" with the system context. That is, the problem is not a permission issue at all.

The registry is mainly divided in two parts, the machine specific part and the user specific part. The user specific part is stored and managed completely individually for each user on the system. This is the HKCU key.

Now, any application or service has to run in a user context (which will then also provide an individual user key in the registry). The "system" context is therefore only sort of a special user, and what you were doing is to read its registry (which did not work out since the system context never ran Internet Explorer).

This said, it should be clear that the exported registry part will be out of the registry of the user you have assigned to the AT command, and not from the currently logged on user.
0
 

Author Comment

by:SigTau66
ID: 7034613
AvonWyss:

Yeah, I found that out running the command with the runas portion of the scheduled task.  After you gave me the answer, I realized I wasn't going to be able to pull that key out for the user I wanted on that PC.  So it looks like I won't be able to get that person's partial history of their Internet usage.  But, you answered my question in the aspect of why it wasn't working.  Which was all I was looking for at this point. :)

I'll continue on with my search for getting someone's Internet history without them knowing it.  Thanks anyway.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Ranking ecommerce websites is a vital process. You need to have a strong SEO (Search Engine Optimization) strategy. If you don’t have one, you are losing out on brand impressions, clicks and sales. Check this guide on how to improve website traffic …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question