PowerShell: Making WebDAV Configuration Edits on Server 2008

If you’re configuring a Windows Server 2008 system to be a ConfigMgr site system, you may have noticed that you need to make some changes to the WebDAV configuration in IIS. Unfortunately, making those changes through the IIS GUI doesn’t always work quite right. Instead of digging around inside of an XML file though, you can simply run a PowerShell script to take care of it!

function FixWebdavConfig()
{
    $xd = New-Object System.Xml.XmlDocument # create new, empty XmlDocument
    $xd.Load("C:WindowsSystem32inetsrvconfigschemaWEBDAV_schema.xml") # Load XML content. returns void, so no need to cast void

    $node = $xd.SelectSingleNode("//attribute[@name='allowAnonymousPropfind']")
    $node.defaultValue = "true"
    $node = $xd.SelectSingleNode("//attribute[@name='allowInfinitePropfindDepth']")
    $node.defaultValue = "false"
    $node = $xd.SelectSingleNode("//attribute[@name='allowCustomProperties']")
    $node.defaultValue = "false"

    $xd.Save("C:WindowsSystem32inetsrvconfigschemaWEBDAV_schema.xml")
}

. FixWebdavConfig

As far as  how to enable WebDAV with PowerShell, I haven’t figured that out just yet, but I wanted to share this for now.

I hope this script helps save you some time in your ConfigMgr deployments!