30 lines
619 B
PowerShell
30 lines
619 B
PowerShell
param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$url
|
|
)
|
|
|
|
function Write-Log($msg) {
|
|
Write-Host $msg -foregroundcolor green
|
|
($msg) | Out-File "log.txt" -Append
|
|
}
|
|
|
|
function Process-List($list) {
|
|
if ($list.BaseTemplate -ne "DocumentLibrary") {
|
|
return
|
|
}
|
|
Write-Log (" " + $list.Title)
|
|
$list.ForceCheckout = $false
|
|
$list.Update()
|
|
}
|
|
|
|
function Process-Web($web) {
|
|
Write-Log ($web.Url)
|
|
$web.Lists | ForEach-Object { Process-List $_ }
|
|
}
|
|
|
|
function Proces-Site($site) {
|
|
$site.AllWebs | ForEach-Object { Process-Web $_ }
|
|
}
|
|
|
|
$webApp = Get-SPWebApplication $url
|
|
$webApp.Sites | ForEach-Object { Proces-Site $_ } |