var adminManager = WScript.CreateObject( "Microsoft.ApplicationHost.Wr
itableAdminManager" );
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var configSection = adminManager.GetAdminSection( "system.webServer/de
faultDocument", "MACHINE/WEBROOT/APPHOST" );
var collection = configSection.GetElementByName( "files" ).Collection;
var newElement = collection.CreateNewElement( "add" );
newElement.Properties.Item( "value" ).Value = "newdefdoc.htm";
collection.AddElement( newElement );
adminManager.CommitChanges();