What you will find here

If you are one of those multi hat kind of person you might want to take a look here.
Some of the sections here will cover: SharePoint, SQL, Server, VB Script, Batch files, PCI Compliance

Icon

Icon

Wednesday, April 16, 2014

Edit library in SharePoint site list with PowerShell


I like simple scripts I don't really like functions and all that when I need is to run a quick update.
Here a really nice one I've modified from some smart guys
I needed to remove the property "Force Check Out" from all libraries on my site collection.
 

$sites = Get-SPWeb {Site URL}
foreach ($site in $sites.webs)
{
$web = Get-SPWeb $site.URL
$library = $web.Lists[{Library Name}]
$library.ForceCheckOut = $false
$library.Update()
$web.Update()
$web.Dispose()
}
 
Additional options here

$library.EnableVersioning = $true
$library.EnableMinorVersions = $true
$library.MajorVersionLimit = $majorVersionLimit
$library.MajorWithMinorVersionsLimit = $minorVersionLimit
$library.ForceCheckOut = $requireCheckOut

I hope it helps