Get-SPSite | select url, @{label="Size in MB";Expression={$_.usage.storage/1MB}}
Bei Webs scheint das ganze etwas komplizierter.
Ich habe mal das folgende Skript verwendet um eine Näherung zu erreichen - ich hoffe ich habe nichts großes "vergessen":
function Get-SPWebSize {
<#
.SYNOPSIS
Measures the size of an SPWeb - be warned that this is only an estimate,
as SharePoint has no OOTB function to measure the size of an web.
.PARAMETER Web
the web to measure
.PARAMETER HumanReadable
whether the output should be human-readable (KB, MB, GB, TB)
.EXAMPLE
Get-SPWeb path/to/web | Get-SPWebSize -HumanReadable GB
#>
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, ValueFromPipeline=$True, HelpMessage = "the SPWeb to measure")]
[Microsoft.SharePoint.SPWeb]$Web,
[Parameter(Mandatory=$false, HelpMessage = "set to a size to measure in (e.g. KB or GB)")]
[ValidateSet("None", "KB", "MB", "GB", "TB")]
[string]$HumanReadable = "None",
[Parameter(Mandatory=$false, HelpMessage = "Suppress the startup-warning")]
[Switch]$SuppressWarn = $false
)
if(-not $SuppressWarn) {
Write-Warning "Be aware, that the calculated size is only an estimate!";
}
if((Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null) {
Add-PSSnapin Microsoft.SharePoint.PowerShell
}
function Get-FolderSize {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, ValueFromPipeline=$True)]
[Microsoft.SharePoint.SPFolder]$Folder
)
[long]$size = 0;
$Folder.Files | %{
$size += $_.Length;
}
$Folder.SubFolders | %{
$size += $_ | Get-FolderSize
}
Write-Verbose "Folder $($Folder.ParentWeb.Url +"/"+ $Folder.Url) has size of $size";
$size
}
function Get-SubWebSize {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, ValueFromPipeline=$True)]
[Microsoft.SharePoint.SPWeb]$Web
)
[long]$size = 0;
$Web.Folders | %{
$size += $_ | Get-FolderSize
}
$Web.Webs | %{
$size += $_ | Get-SubWebSize
}
Write-Verbose "Web $($Web.Url) has size of $size";
$size
}
$size = $Web | Get-SubWebSize
if ($HumanReadable -ne "None") {
$size = Invoke-Expression "$size / 1$HumanReadable";
}
$size
}
Der Kommentar wurde von einem Blog-Administrator entfernt.
AntwortenLöschen