脚本工作但权限被拒绝

时间:2015-10-29 15:08:37

标签: 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 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上运行脚本时,它会指出“访问被拒绝”所有用户都被授予了少于对此网络共享上各自文件夹的完全访问权限。有谁知道为什么我仍然会得到“访问被拒绝”?我一直在倾倒所有权限,甚至在一个点上给予用户完全权限,试图解决这个问题,但仍然没有什么

1 个答案:

答案 0 :(得分:0)

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

托梅尔。