Monthly Archive for August, 2007

Script to remotely backup multiple IIS metabases

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: , , , ,

How to repair a trashed IP stack on Windows 2003

Last week I had a BSOD error on one of my MailSweeper servers. Afterwards when it booted into Windows it had disconnected itself from the network and the IPSec service would not start. I'm sure they were having a good laugh at Microsoft when they decided how to word this error message:

Cannot start the IPSec Service
What failed?

The winsock stack can be reset from a command prompt using:

netsh int ip reset resetlog.txt

However in my case it was throwing up this error:

Initialization Function InitHelperDll in IPMONTR.DLL failed to start with error code 10107
The following helper DLL cannot be loaded: DHCPMON.DLL.
The following helper DLL cannot be loaded: WINSMON.DLL.

Thinking back to my NT4 days it used to be possible to reinstall the IP stack by simply removing and adding the TCP/IP protocol, but in Windows 2003 (and XP) it's a core component of Windows and the 'Uninstall' button is disabled. So, if you need to do this then this technet article can be followed. If you're not doing this work on a DC, then booting up into Safe Mode is fine - that's what I did and it worked like a charm.

Technorati Tags: , , ,