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
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
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.
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
Re: Running XCopy using AT command
I have now and everything works.
Thanks
Re: Running XCopy using AT command
You're welcome.
--
Todd J Heron, MCSE
Windows 2003/2000/NT
Re: Running XCopy using AT command
"bejmark" <[email protected]> wrote in message
news:[email protected]...
>
> 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)