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 am trying to backup IIS6 with PowerShell, I have found the method I am after in WMI's IISComputer.BackupWithPassword however when I try to execute it with the following PowerShell:

$IISComputer = Get-WmiObject -Namespace "root/MicrosoftIISv2" -Class "IISComputer"
$IISComputer.BackupWithPassword("D:\Backup\Wednesday\", 1, 6, "QUESTTSTS")

I am presented with:

Exception calling "BackupWithPassword" : "Win32: The parameter is incorrect.

At line:1 char:32

Having tried various combinations of brackets, quotes, flags, etc. I haven't really got any further with figuring out why this dosn't work.

Any thoughts on getting this to work, I am aware of iisback.vbs and other mechanisms for doing this. This is as much an excercise as a practicable solution to a problem.

share|improve this question
up vote 1 down vote accepted

I figured this out eventually, the following code works:

$Password = "WhiskyW4i5kyWh1sky"
$IISComputer = Get-WmiObject -Namespace "root/MicrosoftIISv2" -Class "IISComputer"
$result = $IISComputer.BackupWithPassword("ScriptedBackup", $HIGHEST_VERSION, $BACKUP_OVERWRITE, $Password)

I have tried to emulate the variable names from the TechNet article IisComputer.BackupWithPassword to allow for comparisons. The backup is created in %SYSTEMROOT%\system32\inetsrv\MetaBack named ScriptedBackup.MD9999 and ScriptedBackup.SC9999 these two files can be copied across to another location or backed up by your backup software.

share|improve this answer

I don't have IIS6 handy right now. Check this:

It doesn't appear that you can "mask" the values like you've done with 4+2=6.

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.