I have a script I have been using on another Windows 2008 to delete the IIS7 backup of configs and create a fresh one:
SET DEST=C:\Backup\Web\IIS7
SET BACKUPNAME=IIS7-CONFIGS
%windir%\system32\inetsrv\appcmd.exe delete backup "%BACKUPNAME%"
%windir%\system32\inetsrv\appcmd.exe add backup "%BACKUPNAME%"
robocopy %windir%\system32\inetsrv\backup "%DEST%" /MIR /R:6 /W:10 /ZB
But on a new Windows 2008 server, I get an access denied on the delete:
ERROR ( hresult:80070005, message:Command execution failed.
Access is denied.
)
I have UAC turned off and pretty much copied all the settings from the old server (including user role being an admin). What am I missing?
Old post I know but same issue here just now. I realized then I did not run the "cmd" as an Administrator
So ran CMD as an Administrator and it ran fine.
I had a similar issue running
I was getting 80070005 Access Denied.
I found out the issue was due my web.config being read only (as I used a source code management system that download as read only the files not checked out by the developers).
Removing the read only attribute from the web.config, fixed the issue.
I suppose you have to remove the read only attribute from some config file which should be touched by the above commands.
I would start by running Process Monitor and see if there is any ACCESS DENIED. I would then look in Process Monitor for which User account the ACCESS DENIED happened and give the necessary permission.
+1 for a very nice script and good use of robocopy command.