Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
%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?

share|improve this question
up vote 0 down vote accepted

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.

share|improve this answer
Thanks. The problem is that I am running it from the command line with a user who is part of the Administrators group. So what other permissions to I need to assign them? I even tried running the CMD with "Run as administrator" option. – TruMan1 Apr 6 '10 at 18:31
i ran the script on my machine using CMD as an Admin and that worked fine for me. Procmon should give you more details on what during the delete operation the permission it's looking for which is missing. – Vivek Kumbhar Apr 6 '10 at 20:37
For some reason it is trying to delete as a Guest user. So I changed my script to delete the backup folder instead. – TruMan1 Apr 6 '10 at 21:31

I had a similar issue running

%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "Default Web Site/MyWebApp"

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.