Enabling MSI installations on Windows Server 2008 via PowerShell

Did you know that by default, there are limitations on installing MSI packages on Windows Server 2008 and Windows Server 2008 R2? Neither did I, but you live to learn.

MSDN documents this quite well if you know what to look for. According to the page the server OS default is to disable MSI for unmanaged software. For client OSes, everything is enabled by default, but enterprise admins can of course limit installations by setting this registry value.

Anyway, if you need to run MSI installs on the server, you’ll want to change the registry settings. That’s not hard, but if you need to do it every now and then, you might want to automate it. No surprise here: Enter PowerShell!

Download the script

function Enable-MSIInstallation {

    pushd
    cd hklm:\Software\Policies\Microsoft\Windows\
    if ((test-path -path Installer) -eq $false) { md Installer | out-null }
    cd Installer
    if ((Get-ItemProperty .).DisableMSI -ne $null) { Set-ItemProperty . -name "DisableMSI" -value 0 | out-null }
    else { New-ItemProperty . -name "DisableMSI" -value 0 -PropertyType DWORD | out-null }
    popd
}

function Disable-MSIInstallation {
  
    pushd
    cd hklm:\Software\Policies\Microsoft\Windows\
    if ((test-path -path Installer) -eq $false) { return }
    cd Installer
    if ((Get-ItemProperty .).DisableMSI -ne $null) { 
        Remove-ItemProperty . -name "DisableMSI"
    }
    popd
}

The two defined functions also represent a way to manage the registry through the registry provider, allowing you to browse the registry tree like the file system.

Of course, running these scripts requires administrator rights, so you have to run PowerShell as an administrator.

April 7, 2010 · Jouni Heikniemi · No Comments
Tags:  · Posted in: Windows IT

Leave a Reply