Many years ago I wrote the following KB article:
Truth be told, I wrote the script in that article to help me manage several servers that I controlled. Once I finished the script, I found myself routinely giving it out to customers in order for them to automate their backups, so I decided to turn it into a KB. When IIS 6 came out, Microsoft shipped the IIsBack.vbs script to help customers automate backups.
One of the great things in IIS 7 is the deprecation of the metabase, which has been replaced by applicationHost.config, but the need for backing up your configuration settings is still there. With this in mind, I wrote a small batch file that I schedule to create backups of my configuration settings using the APPCMD utility. Since I've been giving this to customers at Microsoft TechEd, I thought it might make a nice blog post for everyone that can't make it to TechEd.
To use the script, copy the code below into Windows Notepad, then save it to your computer as "BackupIIS.cmd". (I usually save it in "%WinDir%\System32\Inetsrv", but you could save it to your executable search path as well.)
echo.| date | find /i "current">datetime1.tmp
echo.| time | find /i "current">datetime2.tmp
for /f "tokens=1,2,3,4,5,6" %%i in (datetime1.tmp) do (
for /f "tokens=1,2,3,4,5,6" %%i in (datetime2.tmp) do (
for /f "delims=/ tokens=1,2,3" %%i in (datetime1.tmp) do (
for /f "delims=:. tokens=1,2,3,4" %%i in (datetime2.tmp) do (
appcmd add backups %TMPDATETIME%
You can use Task Scheduler in Windows Server 2008's Server Manager to schedule this script to run at whatever interval you choose, although I usually schedule it to run once a week.
Backups will be created in the following path:
Where yyyymmdd is the year, month, day, and hhmmssii is the hour, minute, second, millisecond for the time of the backup.
I hope this helps!