This is a script to backup IIS metabases to a network share. To run this script you need to create a file called iisservers.txt in the script's working directory and add the names of the IIS servers into it, one on each line. Substitute servername and sharename with the destination on your network. The forfiles statements will delete backups older than 7 days. The -7 variable can be changed to suit your needs.
Some of the text has wrapped to the next line due to the formatting of this blog but when copied and pasted the unnecessary line breaks are removed.
if exist o:\MetabaseBackup goto backup
net use o: /delete /Y
net use o: \\servername\sharename\London\Metabase
:backup
for /F %%i in (iisservers.txt) do cscript c:\windows\system32\iisback.vbs /backup /s %%i /b %%i_metabase /b %%i_metabase /overwrite
for /F %%i in (iisservers.txt) do xcopy \\%%i\C$\windows\system32\inetsrv\metaback\*.* o: /y
:cleanup
o:
forfiles /m *.MD* /D -7 /C "cmd /c del @file"
forfiles /m *.SC* /D -7 /C "cmd /c del @file"
c:
net use o: /delete /Y
The script can then be configured to run as a scheduled task, using an account with the appropriate permissions to your IIS Servers.
For backing up SSL certificates there is a vbscript on Technet that can do all certs in a batch job, as appose to one site at a time as with IISCertDeploy.vbs in the IIS 6 Resource Kit.
Technorati Tags: IIS, Metabase, Scripts, Backups, Windows 2003

