Configure WebDAV for SCCM 2007 using AppCmd and PowerShell

If you are one of SCCM administrators and one of you nightmares is the bulk of error messages you receive due to misconfiguration of IIS WebDAV settings, and you are looking for a way to kill you pain. So, it’s my pleasure to inform you that finally you reached your destination. :) :)

In the next few lines I’ll show you how I used AppCmd with PowerShell flavor to automate the process of configuring IIS WebDAV settings in order to smoothly install SCCM 2007 on Windows Server 2008.

 

So, what’s AppCmd?!

AppCmd.exe is a command-line utility used to for building advanced management actions and administration tasks for IIS 7.0. This tool resides under “ %SystemRoot%\System32\InetSrv\ ”.

For more info about AppCmd … Check this article

 

In the script below, I used AppCmd to change WebDAV settings, then compiled it in a form of script using PowerShell. The syntax is very straightforward just read the comment before each command-line and you will know the function.

 

# ---- Start of Code ----- #

# Load AppCmd Directory

$AppCmdDirectory = $env:SystemRoot + "\System32\inetsrv"

cd $AppCmdDirectory

# Enable WebDav

.\appcmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /enabled:true /commit:apphost

# Add Authoring Rule

.\appcmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoringRules /+"[Users='*',path='*',access='Read']" /commit:apphost

# Enable "Allow Anonymous Property Queries"

.\appcmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowAnonymousPropfind:True /commit:apphost

# Enable "Allow Anonymous Property Queries with infinite depth"

.\appcmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowInfinitePropfindDepth:True /commit:apphost

# Disable "Allow Custom Properties"

.\appcmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowCustomProperties:false /commit:apphost

# Enable "Allow Hidden Files to be listed"

.\appcmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /fileSystem.allowHiddenFiles:True /commit:apphost

# ---- End of Code ----- #

WebDAV changes in this scripts happens according to this article: How to Configure Windows Server 2008 for Configuration Manager 2007 Site Systems

 

Regards
Sherif Talaat (Twitter: @Sheriftalaat)