Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Running XCopy using AT command

Windows Server Help


Reply
 
Thread Tools Search this Thread
  #1  
Old 21-10-2004
Ian
 
Posts: n/a
Running XCopy using AT command

I have created a cmd file that copies files from one server to another using
xcopy.
Running the cmd manually and files get copied over.
Schedule it using AT or WINAT and it does not copy the files over.
No error messages are reported.
I have tried using robocopy but the same thing happens.
The log on robocopy reports the following error:

"error 5 (0x00000005) getting file system type of destination access is
denied"

I have checked the permissions of the target directory, even went through a
mapped drive instead of using \\servername etc. I have even checked the
permissions on cmd.exe and svchost.exe.
The only difference between running the cmd file manualy and through the
schedule is manually it used cmd.exe but the AT command uses svchost.exe.

Any ideas please.
Cheers


Reply With Quote
  #2  
Old 21-10-2004
Todd J Heron
 
Posts: n/a
Re: Running XCopy using AT command

1) With the AT command the system account has local access rights but none
on network.
2) Since jobs run in their own environment, you can't make any assumptions
about environment variables, including path, which is why every file system
object should be fully referenced. Ex: use 'C:\winnt\system32\xcopy.exe'
instead of just 'xcopy'.
3) Pick a time (hh:mm) in the not-too-distant future so you don't have to
wait too long. This command will open a 'DOS' console window running in the
context that all AT jobs run in. In that console window, check the
environment variables by typing 'set'. Are the environment
variables what your batch file is expecting? Especially check the value of
'PATH'. If everything looks OK, type the name of your batch file. Since
the console window can be scrolled backwards for 9999 lines, you should be
able to see all the error messages. Fix the errors and try again.
4) Elevate the context of the batch file to that of an administrator on the
target system by first mapping a drive to the target system at the beginning
of the batch file with the Net Use command along with the /user switch.

--
Todd J Heron, MCSE
Windows 2003/2000/NT
Reply With Quote
  #3  
Old 29-10-2004
ian ian is offline
Member
 
Join Date: Nov 2004
Posts: 1
Re: Running XCopy using AT command

Thanks for your reply but I am still having problems, it still keeps coming
up as access is denied when the batch file tries to copy the file over.
Reply With Quote
  #4  
Old 29-10-2004
Todd J Heron
 
Posts: n/a
Re: Running XCopy using AT command

If the batch file runs under the context of the local system account then it
will not have rights on the remote machine, which is why it throws an
"Access denied" error message. Run the batch file in the scheduled task
under the context of an account with the proper permissions on the remote
machine.

--
Todd J Heron, MCSE
Windows 2003/2000/NT
Reply With Quote
  #5  
Old 01-11-2004
Ian
 
Posts: n/a
Re: Running XCopy using AT command

I have now and everything works.
Thanks
Reply With Quote
  #6  
Old 01-11-2004
Todd J Heron
 
Posts: n/a
Re: Running XCopy using AT command

You're welcome.

--
Todd J Heron, MCSE
Windows 2003/2000/NT
Reply With Quote
  #7  
Old 12-02-2007
Member
 
Join Date: Feb 2007
Posts: 1
Similar problem

I just ran into essentially the same problem. I created a .bat file to
run a copy command so that a backup copy (essentially) of a given file could
be copied from a Win XP computer on one subnet to a Win Serv 2003 computer
on another subnet. This failed with an "Access is denied" message. Dumping
some info to a log file, I discovered that the username present when the
.bat file is running is "nt authority\SYSTEM". Why (besides the fact that this
utility was taken by Microsoft and rewritten) is it that the user starting the
"at" command, or the owner of the .bat file, is not used? I tried using the
"runas" command to get around this problem, but that command insists on
a password from the command line, and I need the "at" command to run
unattended. The target computer does have a SYSTEM user already, and
that user has full control rights to the directory and file in question.

Thanks!
Reply With Quote
  #8  
Old 13-02-2007
Herb Martin
 
Posts: n/a
Re: Running XCopy using AT command


"bejmark" <bejmark.2lwh3c@DoNotSpam.com> wrote in message
news:bejmark.2lwh3c@DoNotSpam.com...
>
> I just ran into essentially the same problem. I created a .bat file to
> run a copy command so that a backup copy (essentially) of a given file
> could
> be copied from a Win XP computer on one subnet to a Win Serv 2003
> computer
> on another subnet. This failed with an "Access is denied" message.
> Dumping
> some info to a log file, I discovered that the username present when
> the
> bat file is running is "nt authority\SYSTEM". Why (besides the fact
> that this
> utility was taken by Microsoft and rewritten) is it that the user
> starting the
> "at" command, or the owner of the .bat file, is not used? I tried using
> the
> "runas" command to get around this problem, but that command insists
> on
> a password from the command line, and I need the "at" command to run
> unattended. The target computer does have a SYSTEM user already, and
> that user has full control rights to the directory and file in
> question.


Don't use the "AT" command (it is obsolete) but rather the SchTasks.exe
command which has a full set of switches for setting Run User name and
password.


--
Herb Martin, MCSE, MVP
http://www.LearnQuick.Com
(phone on web site)


Reply With Quote
  #9  
Old 26-09-2007
Member
 
Join Date: Sep 2007
Posts: 1
I have a similar problem to the above. However, i'm running a batch file that calls robocopy and uses the /MIR switch to mirror a 2nd drive physically installed on the machine, to an external hard drive also physically attached to the machine. So in this case, there is no network authentication issue involved.

The batch process initially seemed to start off ok, but after a few minutes of copying files, came up with the following error:

Error 5 (0x00000005) Copying File D:/folder/folder/filename.exe
Access is denied
Waiting 30 seconds... Retrying...

I've used this method before, but only on simple setups with just a few files. In this case, about 250GB of files are being mirrored. The first few files this error came up on, weren't important, so i could just delete them, but now i've hit the problem with a file i do need.

The drive is just a 2nd physical data drive, not the system drive, and the files in question are definitely not in use. I thought it might be an ownership issue, as it shows the owner as an uknown SID. So i took ownership of the file (with the administrator account running the script), and ran the script again, but it stopped at the same file again.

In fact, i've found that even trying to run the file (which is a .exe file) in this case reports that 'Windows cannot access the specified device, path or file. You may not have the appropriate permission to access the item'.

I've checked the 'effective permissions' on this file, for the account that tried to open it, and all the boxes are ticked (ie the account has full control)

Any ideas?

Last edited by markey164 : 26-09-2007 at 10:38 PM.
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Running XCopy using AT command"
Thread Thread Starter Forum Replies Last Post
Command and Conquer 3 Tiberium Wars is not running on Windows 7 x64 Zakiy Video Games 8 05-09-2011 10:41 PM
xcopy command line together with wmplayer command line Aislinn Operating Systems 5 31-03-2010 12:13 PM
XCOPY command in bat file doesn't run as scheduled task Laurense Operating Systems 4 29-03-2010 06:02 PM
How to run the Xcopy command on XP Mansi gala Operating Systems 3 31-10-2009 06:38 PM
Excel - Select Switch Command keeps running wuuhaahaa Windows Software 1 22-10-2009 11:31 PM


All times are GMT +5.5. The time now is 02:38 PM.