Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
Created March 26, 2013 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ciphertxt/5244806 to your computer and use it in GitHub Desktop.
Save ciphertxt/5244806 to your computer and use it in GitHub Desktop.
Sets the UIVersion to v3 or v4 for all sites in a given database
function Set-SPUIVersion(
    [string]$dbName = $(Read-Host -prompt "Content Database Name"),
    [int32]$uiVersion = $(Read-Host -prompt "UI Version"))
    {
    $db = Get-SPContentDatabase $dbName
 
    foreach ($s in $db.Sites) {
        foreach ($w in $s.AllWebs) {
            $w.UIversion = $uiVersion;
            switch ($uiVersion) {
                3 { $w.UIVersionConfigurationEnabled = $true; }
                4 { $w.UIVersionConfigurationEnabled = $false; }
            }
            $w.Update();
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment