Trevor Sullivan's Tech Room

Minding the gap between administration and development

PowerShell: Allowing all file exts. for ConfigMgr

Posted by Trevor Sullivan on 2009/12/15


When running Configuration Manager 2007 on Windows Server 2008, you must enable certain file extensions in IIS, so that a BITS-enabled distribution point (DP) can transfer files correctly. See this Technet article for more information.

If you would like to enable all of the file extensions on a BITS-enabled DP, simply run the following PowerShell code:

function EnableAllExtensions()
{
    $ahPath = "$((Get-WmiObject Win32_OperatingSystem).SystemDirectory)\inetsrv\config\applicationHost.config"
    if (-not [IO.File]::Exists($ahPath)) { return } # If file doesn't exist, return
    $xd = New-Object Xml.XmlDocument
    $xd.Load($ahPath)
    $nodes = $xd.SelectNodes("/configuration/system.webServer/security/requestFiltering/fileExtensions/add")
    foreach ($child in $nodes)
    {
        $child.SetAttribute("allowed", "true")
    }
    $xd.Save($ahPath)
}

. EnableAllExtensions


Hope this helps!

Don’t forget to make your WebDAV configuration edits using PowerShell also!

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: