Solved

Scheduling task using AT not working

Posted on 2002-05-23
9
197 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now