Trevor Sullivan's Tech Room

Minding the gap between administration and development

PowerShell: Making WebDAV Configuration Edits on Server 2008

Posted by Trevor Sullivan on 2009/12/15


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:\Windows\System32\inetsrv\config\schema\WEBDAV_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:\Windows\System32\inetsrv\config\schema\WEBDAV_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!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: