Guest Slingshotz Posted October 3, 2007 Posted October 3, 2007 This is driving me nuts and I have not been able to find any answers on any user group. This is a basic batch file script that I am deploying through group policy in the startup script to copy templates from the server to the local machine. I'm deploying it during the startup so that every computer gets it, regardless of who logs in. ========================= if NOT exist "C:\Templates" md "C:\Templates" pushd "\\servername\Templates\" xcopy *.dot C:\Templates /Y /D popd ========================= The script works perfectly when run by itself, but during the startup script when a computer starts up it keeps saying that *.dot is not found. ========================= File not found - *.dot 0 File(s) copied ========================= When I replace the xcopy with a regular copy command, it works during startup but I need to only copy the files when there are newer templates on the server and thus have to use xcopy. I have confirmed that the computer has permisisons to copy from the server share (it obviously works as the copy command works). I have also tried it without the pushd commands to no avail, i.e. ========================= if NOT exist "C:\Templates" md "C:\Templates" xcopy \\servername\Templates\*.dot C:\Templates /Y /D ========================= The error message is the same, it says file not found. And I have confirmed that xcopy is working on the target machine. Like I said, it works fine on it's own, but when deployed through group policy it won't copy the files (but it makes the folder ok). Any suggestions would be greatly appreciated as I've burnt many hours trying to figure out this silly little problem.
Guest Richard Mueller [MVP] Posted October 4, 2007 Posted October 4, 2007 Re: Xcopy not working in startup script Slingshotz wrote: > This is driving me nuts and I have not been able to find any answers > on any user group. This is a basic batch file script that I am > deploying through group policy in the startup script to copy > templates > from the server to the local machine. I'm deploying it during the > startup so that every computer gets it, regardless of who logs in. > > ========================= > if NOT exist "C:\Templates" md "C:\Templates" > pushd "\\servername\Templates\" > xcopy *.dot C:\Templates /Y /D > popd > ========================= > > > The script works perfectly when run by itself, but during the startup > script when a computer starts up it keeps saying that *.dot is not > found. > > > ========================= > File not found - *.dot > 0 File(s) copied > ========================= > > > When I replace the xcopy with a regular copy command, it works during > startup but I need to only copy the files when there are newer > templates on the server and thus have to use xcopy. > > > I have confirmed that the computer has permisisons to copy from the > server share (it obviously works as the copy command works). I have > also tried it without the pushd commands to no avail, i.e. > > > ========================= > if NOT exist "C:\Templates" md "C:\Templates" > xcopy \\servername\Templates\*.dot C:\Templates /Y /D > ========================= > > > The error message is the same, it says file not found. And I have > confirmed that xcopy is working on the target machine. Like I said, > it works fine on it's own, but when deployed through group policy it > won't copy the files (but it makes the folder ok). > > > Any suggestions would be greatly appreciated as I've burnt many hours > trying to figure out this silly little problem. > I am not familiar with pushd and I cannot explain why copy would work when xcopy does not. However, it is common for scripts to work when you run them but not as a Startup script. When a Startup script runs there is no user. Startup scripts run with System privileges on the local computer, but with the permissions of the computer object elsewhere in the domain. The most likely cause is that the computer object (computer domain account) lacks permissions in the share. If all computers need permissions, you can grant the permissions to the domain group "Domain Computers". -- Richard Mueller Microsoft MVP Scripting and ADSI Hilltop Lab - http://www.rlmueller.net --
Guest Chris M Posted October 4, 2007 Posted October 4, 2007 Re: Xcopy not working in startup script Slingshotz wrote: > This is driving me nuts and I have not been able to find any answers > on any user group. This is a basic batch file script that I am > deploying through group policy in the startup script to copy > templates > from the server to the local machine. I'm deploying it during the > startup so that every computer gets it, regardless of who logs in. > > ========================= > if NOT exist "C:\Templates" md "C:\Templates" > pushd "\\servername\Templates\" > xcopy *.dot C:\Templates /Y /D > popd > ========================= It is almost certainly something to do with the running context of the script... startup scripts run as the local SYSTEM account which can make things tricky when network access is concerned. When you tested the script successfully using a plain copy command, did you also use the PUSHD command before it or did you just use the UNC path in the command? Cheers, -- Chris.
Guest Pegasus \(MVP\) Posted October 4, 2007 Posted October 4, 2007 Re: Xcopy not working in startup script Multi-posted. http://www.blakjak.demon.co.uk/mul_crss.htm "Slingshotz" <slingshotz@yahoo.com> wrote in message news:1191452914.733971.243870@g4g2000hsf.googlegroups.com... > This is driving me nuts and I have not been able to find any answers > on any user group. This is a basic batch file script that I am > deploying through group policy in the startup script to copy > templates > from the server to the local machine. I'm deploying it during the > startup so that every computer gets it, regardless of who logs in. > > ========================= > if NOT exist "C:\Templates" md "C:\Templates" > pushd "\\servername\Templates\" > xcopy *.dot C:\Templates /Y /D > popd > ========================= > > > The script works perfectly when run by itself, but during the startup > script when a computer starts up it keeps saying that *.dot is not > found. > > > ========================= > File not found - *.dot > 0 File(s) copied > ========================= > > > When I replace the xcopy with a regular copy command, it works during > startup but I need to only copy the files when there are newer > templates on the server and thus have to use xcopy. > > > I have confirmed that the computer has permisisons to copy from the > server share (it obviously works as the copy command works). I have > also tried it without the pushd commands to no avail, i.e. > > > ========================= > if NOT exist "C:\Templates" md "C:\Templates" > xcopy \\servername\Templates\*.dot C:\Templates /Y /D > ========================= > > > The error message is the same, it says file not found. And I have > confirmed that xcopy is working on the target machine. Like I said, > it works fine on it's own, but when deployed through group policy it > won't copy the files (but it makes the folder ok). > > > Any suggestions would be greatly appreciated as I've burnt many hours > trying to figure out this silly little problem. >
Guest Slingshotz Posted October 4, 2007 Posted October 4, 2007 Re: Xcopy not working in startup script On Oct 3, 6:11 pm, "Richard Mueller [MVP]" <rlmueller- nos...@ameritech.nospam.net> wrote: > Slingshotz wrote: > > This is driving me nuts and I have not been able to find any answers > > on any user group. This is a basic batch file script that I am > > deploying through group policy in the startup script to copy > > templates > > from the server to the local machine. I'm deploying it during the > > startup so that every computer gets it, regardless of who logs in. > > > ========================= > > if NOT exist "C:\Templates" md "C:\Templates" > > pushd "\\servername\Templates\" > > xcopy *.dot C:\Templates /Y /D > > popd > > ========================= > > > The script works perfectly when run by itself, but during the startup > > script when a computer starts up it keeps saying that *.dot is not > > found. > > > ========================= > > File not found - *.dot > > 0 File(s) copied > > ========================= > > > When I replace the xcopy with a regular copy command, it works during > > startup but I need to only copy the files when there are newer > > templates on the server and thus have to use xcopy. > > > I have confirmed that the computer has permisisons to copy from the > > server share (it obviously works as the copy command works). I have > > also tried it without the pushd commands to no avail, i.e. > > > ========================= > > if NOT exist "C:\Templates" md "C:\Templates" > > xcopy \\servername\Templates\*.dot C:\Templates /Y /D > > ========================= > > > The error message is the same, it says file not found. And I have > > confirmed that xcopy is working on the target machine. Like I said, > > it works fine on it's own, but when deployed through group policy it > > won't copy the files (but it makes the folder ok). > > > Any suggestions would be greatly appreciated as I've burnt many hours > > trying to figure out this silly little problem. > > I am not familiar with pushd and I cannot explain why copy would work when > xcopy does not. However, it is common for scripts to work when you run them > but not as a Startup script. When a Startup script runs there is no user. > Startup scripts run with System privileges on the local computer, but with > the permissions of the computer object elsewhere in the domain. The most > likely cause is that the computer object (computer domain account) lacks > permissions in the share. If all computers need permissions, you can grant > the permissions to the domain group "Domain Computers". > > -- > Richard Mueller > Microsoft MVP Scripting and ADSI > Hilltop Lab -http://www.rlmueller.net > --- Hide quoted text - > > - Show quoted text - That was one of the first things I did was to add the Domain Computers group to the share to be able to read. I even tried granting Everyone to have read rights to the folder just to make sure it wasn't a permissions issue. All pushd does is map a temporarily drive letter for the UNC path and set that drive letter as the current working drive. I found that suggestion when trawling around on the groups as I thought it might have been a UNC issue with the dos window. I forgot to mention that the script I am trying to run it on is a new XP Pro computer (on the domain) with a 2003 domain controller, so it's not a really strange setup.
Guest Slingshotz Posted October 4, 2007 Posted October 4, 2007 Re: Xcopy not working in startup script On Oct 3, 6:11 pm, Chris M <nob...@nowhere.special> wrote: > Slingshotz wrote: > > This is driving me nuts and I have not been able to find any answers > > on any user group. This is a basic batch file script that I am > > deploying through group policy in the startup script to copy > > templates > > from the server to the local machine. I'm deploying it during the > > startup so that every computer gets it, regardless of who logs in. > > > ========================= > > if NOT exist "C:\Templates" md "C:\Templates" > > pushd "\\servername\Templates\" > > xcopy *.dot C:\Templates /Y /D > > popd > > ========================= > > It is almost certainly something to do with the running context of the > script... startup scripts run as the local SYSTEM account which can make > things tricky when network access is concerned. > > When you tested the script successfully using a plain copy command, did > you also use the PUSHD command before it or did you just use the UNC > path in the command? > > Cheers, > > -- > Chris. I tried both and both methods worked with a plain copy command.
Guest David Posted October 4, 2007 Posted October 4, 2007 Re: Xcopy not working in startup script What is the filename? I had an issue when I named my file xcopy.bat and then used the xcopy command in the batch file. It was trying to execute the file again instead of run the xcopy command. "Slingshotz" <slingshotz@yahoo.com> wrote in message news:1191452914.733971.243870@g4g2000hsf.googlegroups.com... > This is driving me nuts and I have not been able to find any answers > on any user group. This is a basic batch file script that I am > deploying through group policy in the startup script to copy > templates > from the server to the local machine. I'm deploying it during the > startup so that every computer gets it, regardless of who logs in. > > ========================= > if NOT exist "C:\Templates" md "C:\Templates" > pushd "\\servername\Templates\" > xcopy *.dot C:\Templates /Y /D > popd > ========================= > > > The script works perfectly when run by itself, but during the startup > script when a computer starts up it keeps saying that *.dot is not > found. > > > ========================= > File not found - *.dot > 0 File(s) copied > ========================= > > > When I replace the xcopy with a regular copy command, it works during > startup but I need to only copy the files when there are newer > templates on the server and thus have to use xcopy. > > > I have confirmed that the computer has permisisons to copy from the > server share (it obviously works as the copy command works). I have > also tried it without the pushd commands to no avail, i.e. > > > ========================= > if NOT exist "C:\Templates" md "C:\Templates" > xcopy \\servername\Templates\*.dot C:\Templates /Y /D > ========================= > > > The error message is the same, it says file not found. And I have > confirmed that xcopy is working on the target machine. Like I said, > it works fine on it's own, but when deployed through group policy it > won't copy the files (but it makes the folder ok). > > > Any suggestions would be greatly appreciated as I've burnt many hours > trying to figure out this silly little problem. >
Guest Slingshotz Posted October 10, 2007 Posted October 10, 2007 Re: Xcopy not working in startup script The batch name is simply templates.bat so it shouldn't have any issues. For troubleshooting purposes I have tried the following batch file: if NOT exist "C:\Templates" md "C:\Templates" pushd "\\servername\Templates\" dir xcopy /? xcopy test.dot C:\Templates /Y /D popd pause I can see that it makes the folder on the C: drive, then maps a drive letter to the server share (in this case Z:), then displays the directory list ok (shows test.dot in the listing), then shows the xcopy help commands (which means xcopy is locatable and working), then tries to copy the file and says File not found - test.dot, then unmaps the drive Z:. I have a sneaking suspicion that it is some kind of wierd permissions issue but I can't understand why it won't let me xcopy the files but will let me do a regular copy. Does xcopy use different security credentials than copy? Is there any broader group than 'Everyone' for security as I have even tried granting Everyone and Domain Computers full permissions to the folder? Bag of cookies to anyone with a simple explanation/solution!
Guest Jon Matheny Posted August 29, 2008 Posted August 29, 2008 same problem here!!! same problem here!!! I have the exact same problem and have not found a solution for it. If anyone here has a solution, I would be very thankful. I do NOT want to use a login script for what I'm doing. I have to use a startup script. My copy works. But no xcopy. Like I said, same issue. Thanks.
Guest Meinolf Weber Posted August 29, 2008 Posted August 29, 2008 Re: same problem here!!! Re: same problem here!!! Hello Jon, For what problem??? Best regards Meinolf Weber Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights. ** Please do NOT email, only reply to Newsgroups ** HELP us help YOU!!! http://www.blakjak.demon.co.uk/mul_crss.htm > I have the exact same problem and have not found a solution for it. If > anyone here has a solution, I would be very thankful. I do NOT want to > use a login script for what I'm doing. I have to use a startup script. > My copy works. But no xcopy. Like I said, same issue. Thanks. >
Recommended Posts