Sub BackupIISMetaBase(IISServer, BackupName) ' Backup the IIS Metabase On Error Resume Next Flags = (MD_BACKUP_SAVE_FIRST Or MD_BACKUP_FORCE_BACKUP) Set IIsComputer = GetObject("IIS://" & IISServer) If Err.Number <> 0 Then WScript.Echo "Failed to create IIS Server object" WScript.Quit(2) End If IIsComputer.Backup BackupName, MD_BACKUP_NEXT_VERSION, Flags4 If Err.Number <> 0 Then WScript.Echo "Failed to create backup" WScript.Quit(3) End If Set IIsComputer = Nothing End Sub Sub RestoreIISMetabase(IISServer, Backupname) ' Restores an existing IIS Metabase backup ' The following line is to make sure that you definetly want to continue with this operation. continue = MsgBox("This operation will restore the IIS Metabase. Are you sure you want to do this?", vbYesNo, "IIS Metabase Script") If continue = vbNo Then WScript.Echo "Metabase restore aborted." WScript.Quit(0) End If Set IIsComputer = GetObject("IIS://" & IISServer) IIsComputer.Restore Backupname, MD_BACKUP_HIGHEST_VERSION, 0 Set IIsComputer = Nothing End Sub Sub DeleteIISMetabaseBackup(IISServer, Backupname) ' Delete an existing IIS Metabase backup Set IIsComputer = GetObject("IIS://" & IISServer) IIsComputer.DeleteBackup Backupname, MD_BACKUP_HIGHEST_VERSION Set IIsComputer = Nothing End Sub