码迷,mamicode.com
首页 > 其他好文 > 详细

SharePoint2013 Powershell script to get site Title, Site Owner, Site user count and usage

时间:2014-07-02 20:27:22      阅读:704      评论:0      收藏:0      [点我收藏+]

标签:os   cti   for   io   res   app   

Powershell script to get site Title, Site Owner, Site user count and usage

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
$wburl = Read-Host "Enter Web application URL "
$webApp = Get-SPWebApplication $wburl
$outputPath =Read-Host "Enter path to save results "
Add-Content -Path $outputPath -Value "Site Title,Site URL, Site Owner, UserCount,Usage in MB"
foreach ($SiteCollection in $webApp.Sites)
{
$url = $SiteCollection.Url
$webs = Get-SPWeb $URL
[boolean] $WriteToFile = $true
$weburl = $SiteCollection.OpenWeb()
$siteowner = ""
foreach ($siteAdmin in $weburl.SiteAdministrators)
{
$siteowner = $siteAdmin.LoginName + "|" + $siteowner
}
foreach($web in $webs)
{
#Grab all users in the site collections
$siteUserCnt = $web.AllUsers.Count
$Siteurl = $web.Url
$siteTitle = $web.Title
$site = Get-SPSite  $Siteurl

$siteusage = $site.Usage.Storage/1MB

Add-Content -Path $outputPath -Value "$siteTitle,$Siteurl,$siteowner,$siteUserCnt,$siteusage"
$web.Dispose()
}
}

SharePoint2013 Powershell script to get site Title, Site Owner, Site user count and usage,布布扣,bubuko.com

SharePoint2013 Powershell script to get site Title, Site Owner, Site user count and usage

标签:os   cti   for   io   res   app   

原文地址:http://www.cnblogs.com/csts/p/3819271.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!