0

我需要能够创建所有现有页面及其页面布局的报告。我有以下 powershell 脚本,但即使使用 Recursive 它也只能从根网络返回给我的脚本。

filter Get-PublishingPages { 
    $pubweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($_)
    $query = new-object Microsoft.SharePoint.SPQuery 
    $query.ViewAttributes = "Scope='Recursive'"
    $pubweb.GetPublishingPages($query)    
} 
$url="https://xxxxl.com"
get-spweb $url | Get-PublishingPages | select Uri, Title, @{Name='PageLayout';Expression={$_.Layout.ServerRelativeUrl}}
4

2 回答 2

3

这对我有用。

filter Get-PublishingPages {
$pubweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($_)
$query = new-object Microsoft.SharePoint.SPQuery

$query.ViewAttributes = "Scope='Recursive'"
$pubweb.GetPublishingPages($query)
}

$str = "http://yourdomain.com" // your URL
if($str -eq $null )
{
Write-Host “Enter a valid URL”
return
}

$site = Get-SPSite -Identity $str
if($site -eq $null)
{
Write-Host “Enter a valid URL”
return
}

$allweb = $site.Allwebs
foreach($web in $allweb )
{
$web | Get-PublishingPages | select Uri, Title, @{Name=’PageLayout’;Expression={$_.Layout.ServerRelativeUrl}}| Format-List
}
于 2013-12-03T19:01:56.147 回答
0

在这里有点摸不着头脑,但是您是否尝试过将范围设置为 RecursiveAll 而不仅仅是 Recursive?我的理解是 Recursive 只命中文件夹中的所有文件,而 RecursiveAll 也获取所有子文件夹。

参考: http: //msdn.microsoft.com/en-us/library/microsoft.sharepoint.spviewscope.aspx ?cs-save-lang=1&cs-lang=csharp#code-snippet-1

于 2013-09-04T15:47:14.443 回答