Vstupní parametry:
- nejsou
Příklad:
.\CheckSiteCollectionsLock.ps1
<# .Synopsis Enumerate all site collections and write out lock status .Example .\CheckSiteCollectionsLock.ps1 .Notes NAME: .\CheckSiteCollectionsLock.ps1 AUTHOR: novotny@devit.cz .Link http://www.devit.cz #> Add-pssnapin Microsoft.SharePoint.Powershell -ErrorAction silentlycontinue $webApps = Get-SPWebApplication | foreach { write-host "Web App: " $_.Url $sites = $_.Sites | foreach { write-host " $($_.RootWeb.Url) ($($_.RootWeb.Title)): " -foregroundcolor Green -NoNewline if ($_.ReadOnly -eq $false -and $_.ReadLocked -eq $false -and $_.WriteLocked -eq $false) { write-host "Unlocked" -foregroundcolor Green } else { if ($_.ReadOnly -eq $false -and $_.ReadLocked -eq $false -and $_.WriteLocked -eq $true) { write-host "Adding Content Prevented" -foregroundcolor Red } elseif ($_.ReadOnly -eq $true -and $_.ReadLocked -eq $false -and $_.WriteLocked -eq $true) { write-host "Read-only" -foregroundcolor Red } elseif ($_.ReadOnly -eq $null -and $_.ReadLocked -eq $null -and $_.WriteLocked -eq $null) { write-host "No Access" -foregroundcolor Red } if ($_.lockissue -ne $null) { write-host " Message: $($_.LockIssue)" -BackgroundColor Red } } } }