powershell 迁移Web应用程序中所有Web的SharePoint UI(v3到v4)。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 迁移Web应用程序中所有Web的SharePoint UI(v3到v4)。相关的知识,希望对你有一定的参考价值。

# ----------------------------------------------
# Author: Romain Blanchard
# Date: 15.04.2013
# Description: Migrate SharePoint UI (v3 to v4) of all webs in Web Application.
# ----------------------------------------------

# Parameters
param([string]$webAppUrl)

# Initialize
$logfile = "MigrateWebApp_logs.txt"

# Script
$webApp = Get-SPWebApplication | where {$_.Url -eq $webAppUrl }
if ($webApp -eq $null)
{
	Write-Host "WebApp not found"
    Write-Output "WebApp not found" | out-file -filepath $logfile -append
	return;
}

foreach ($site in $webApp.Sites)
{
    foreach ($web in $site.AllWebs)
    {
        try
        {
            if ($web.UIVersion -eq 3)
            {
                #$web.UIVersion = 4
                #$web.Update()
                
                $date = Get-Date -format G
                Write-Host "$date ----- SUCCESS ---- $web has been migrate to UIV4!"
                Write-Output "$date ----- SUCCESS ---- $web has been migrate to UIV4!" | out-file -filepath $logfile -append
            }
            
            $web.Dispose()
        }
        catch
        {
            $date = Get-Date -format G
            Write-Host "$date ----- ERROR ---- Web: $web ; $_"
            Write-Output "$date ----- ERROR ---- Web: $web ; $_" | out-file -filepath $logfile -append
        }
    }
    
    $site.Dispose()   
}

以上是关于powershell 迁移Web应用程序中所有Web的SharePoint UI(v3到v4)。的主要内容,如果未能解决你的问题,请参考以下文章