Batch file 脚本工作,但权限被拒绝

Batch file 脚本工作,但权限被拒绝,batch-file,permissions,Batch File,Permissions,我使用一个同事的脚本进行用户备份,并重新编写,以更好地满足公司的需要。我得到了他的许可,他现在也使用这个脚本。下面是我的想法: rem This script was put together by A Domain Admin rem using a previous script by another Domain Admin rem for the purpose of backing up users files on rem their PC's to a network share

我使用一个同事的脚本进行用户备份,并重新编写,以更好地满足公司的需要。我得到了他的许可,他现在也使用这个脚本。下面是我的想法:

rem This script was put together by A Domain Admin
rem using a previous script by another Domain Admin
rem for the purpose of backing up users files on
rem their PC's to a network share using the 
rem RoboCopy function. It will copy their Desktop,
rem My Documents, and Favorites folders.
rem Remember that an initial folder with each users 
rem domain name will need to be made on the network 
rem share in order to have this work.

rem This portion builds the different files needed
rem on the specified server to place the backed up
rem files in
@mkdir \\DC-FS1\users\%username%\%computername%\ 
@mkdir \\DC-FS1\users\%username%\%computername%\Desktop\ 
@mkdir \\DC-FS1\users\%username%\%computername%\My_Documents\ 
@mkdir \\DC-FS1\users\%username%\%computername%\Favorites\ 

rem This prints to the screen all the user will 
rem need to know before the backup happens
@cls
@echo TriTech Software Systems - :User.Backup:
@echo For support, please call IS at ext. 7499
@echo --------------------------------------------------------------
@echo Press any key to start the synchronization of your "Desktop",
@echo "Favorites", and "My Documents" folders to a network server.
@echo --------------------------------------------------------------
@echo This will NOT include any virtual machines, music files, or 
@echo video files located in these areas. It will also remove
@echo from the backup any objects that are no longer in the backed 
@echo up area. This will also NOT include any folders not in the
@echo 3 specified. 
@pause

rem This is the actual backup processes. I added a 
rem pause at the end so the user could check to see 
rem if any errors had occured during the backup if  
rem they would like
robocopy "C:\users\%username%\Desktop" \\DC-FS1\f$\backups\users\%username%\%computername%\Desktop\ /s /xf *.avi *.iso *.mp3 *.m4a *.m4b *.m4p *.m4v *.mp4 *.ova *.vmdk *.vmem *.vmss *.vhd *.wma *.wmv *.pst *.bak *.epub *.ipa *.mobi *.mov *.rdp /purge
robocopy "C:\users\%username%\My Documents" \\DC-FS1\f$\backups\users\%username%\%computername%\My_Documents\ /s /xf *.avi *.iso *.mp3 *.m4a *.m4b *.m4p *.m4v *.mp4 *.ova *.vmdk *.vmem *.vmss *.vhd *.wma *.wmv *.pst *.bak *.epub *.ipa *.mobi *.mov *.rdp /purge
robocopy "C:\users\%username%\Favorites" \\DC-FS1\f$\backups\users\%username%\%computername%\Favorites\ /s /xf *.avi *.iso *.mp3 *.m4a *.m4b *.m4p *.m4v *.mp4 *.ova *.vmdk *.vmem *.vmss *.vhd *.wma *.wmv *.pst *.bak *.epub *.ipa *.mobi *.mov *.rdp /purge
@pause

除了一件事之外,这个剧本非常棒。当用户(域管理员除外)在每次robocopy声明“访问被拒绝”后在其PC上运行脚本时,所有用户都已获得对此网络共享上各自文件夹的完全访问权限。有人知道为什么我仍然会得到“访问被拒绝”吗?我一直在倾注所有权限,甚至在某一点上授予用户尝试解决此问题的完全权限,但仍然没有任何内容

尝试以管理员身份运行脚本


Tomer.

尝试以管理员身份运行脚本



Tomer.

我认为这与您使用管理共享而不是实际的服务器共享有关。域管理员不会有问题,但普通帐户会有问题。我认为这篇文章对它的描述是正确的。你认为如果我把F$从robocopy中拿出来就能解决我的问题吗?我是否可以将该部分缩短为网络共享中只有他们有权限访问的文件夹?是否为每个用户创建了名为backups的服务器共享,并具有相应的文件和共享权限?是的。所有权限似乎都设置正确,但用户对“用户”文件夹前面的任何内容都没有任何权限。这可能是问题所在吗?我相信这与您使用管理共享而不是实际的服务器共享有关。域管理员不会有问题,但普通帐户会有问题。我认为这篇文章对它的描述是正确的。你认为如果我把F$从robocopy中拿出来就能解决我的问题吗?我是否可以将该部分缩短为网络共享中只有他们有权限访问的文件夹?是否为每个用户创建了名为backups的服务器共享,并具有相应的文件和共享权限?是的。所有权限似乎都设置正确,但用户对“用户”文件夹前面的任何内容都没有任何权限。如果我想以管理员身份运行它,这可能是问题所在吗。谢谢你的回复。但我想让标准网络用户从他们的桌面而不是管理员的身份运行此命令。@EddieStuder,我不知道如果这不是您需要的答案,为什么您会将其标记为问题的答案。@Squashman他确实提供了一个解决方案。我对stackoverflow还是相当陌生的。我希望你能发布一个答案,这样我就可以把它标记为答案。@EddieStuder,我所做的只是引导你走上正确的方向。@Squashman是的,但这就是我想要的答案。托默给了我一个答案,你给了我我想要的答案。我真的很感激你给我的帮助。如果我想以管理员的身份运行它,您帮助我了解了这一点。谢谢你的回复。但我想让标准网络用户从他们的桌面而不是管理员的身份运行此命令。@EddieStuder,我不知道如果这不是您需要的答案,为什么您会将其标记为问题的答案。@Squashman他确实提供了一个解决方案。我对stackoverflow还是相当陌生的。我希望你能发布一个答案,这样我就可以把它标记为答案。@EddieStuder,我所做的只是引导你走上正确的方向。@Squashman是的,但这就是我想要的答案。托默给了我一个答案,你给了我我想要的答案。我真的很感激你给我的帮助。一路上你帮我学习