Solved

Scheduling task using AT not working

Posted on 2002-05-23
9
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 14

Accepted Solution

by:
AvonWyss earned 200 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 eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

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…
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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