powershell 这通过PowerShell计算SharePoint中的各种项目
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 这通过PowerShell计算SharePoint中的各种项目相关的知识,希望对你有一定的参考价值。
$SPWebApp = Get-SPWebApplication https://xxx
$numberofCollections = $SPWebApp.Sites.Count
$numberofWebs = 0
$numberoflists = 0
foreach ($SPSite in $SPWebApp.Sites)
{
write-host "Site collection: " $SPSite.Url
foreach ($SPWeb in $SPSite.AllWebs)
{
$numberofWebs++
foreach ($list in $SPWeb.Lists)
{
$numberoflists++
<#
$ListURL = $SPWeb.url + "/" + $list.RootFolder.Url
Write-Output $ListURL
[Microsoft.SharePoint.SPQuery]$query = New-Object Microsoft.SharePoint.SPQuery
$query.ViewAttributes = "Scope='Recursive'"
$allitems = $list.GetItems($query);
$filecount = $allitems.Count;
Write-Output " No of item: " $filecount
#>
if ($SPWeb -ne $null)
{
$SPWeb.Dispose()
}
}
}
if ($SPSite -ne $null)
{
$SPSite.Dispose()
}
}
write-host "Number of collections" $numberofCollections
write-host "Number of Webs" $numberofWebs
write-host "Number of lists" $numberoflists
$numberofWebs = 0
$numberoflists = 0
$SPSite = Get-SPSite https://xxxxx
foreach ($SPWeb in $SPSite.AllWebs)
{
$numberofWebs++
foreach ($list in $SPWeb.Lists)
{
$numberoflists++
<#
$ListURL = $SPWeb.url + "/" + $list.RootFolder.Url
Write-Output $ListURL
[Microsoft.SharePoint.SPQuery]$query = New-Object Microsoft.SharePoint.SPQuery
$query.ViewAttributes = "Scope='Recursive'"
$allitems = $list.GetItems($query);
$filecount = $allitems.Count;
Write-Output " No of item: " $filecount
#>
if ($SPWeb -ne $null)
{
$SPWeb.Dispose()
}
}
}
write-host "Number of Webs" $numberofWebs
write-host "Number of lists" $numberoflists
以上是关于powershell 这通过PowerShell计算SharePoint中的各种项目的主要内容,如果未能解决你的问题,请参考以下文章
PowerShell小技巧:通过 PowerShell实现日志关键字分析
PowerShell 脚本执行策略
通过 Powershell 连接到 ***
通过 C# 代码执行 Powershell 命令
Powershell:通过 UpgradeCode 卸载应用程序
通过命令行将变量传递给powershell脚本