0

Below is what I'm looking for a PowerShell script to do.

  1. Check the setting (ANY USER WHO CAN READ ITEM – IS THE CORRECT SETTING)
  2. If it is not correct, change it
  3. Send email to select group

Any help would be appreciated.

This is what I've found so far which would change the Draft Item Security:

$siteURL="http://site"
$listName="Documents"
$site=Get-SPSite $siteURL
$web=$site.RootWeb
$list=$web.Lists[$listName]
$list.DraftVersionVisibility = 0
$list.Update()
1

Stumbling over this question while I was looking for an answer myself, I decided to post my results to answer your question.

I Used the following Powershell script to set readablity for certain Library's to "Reader".

Also the script gets all web applications and looks within to find the site collections and sites and here it checks for the presence of 3 lists.

Hope you still find it usefull (or maybe other folks looking for an answer)

# Get all Web applications
Get-SPWebApplication
ForEach-Object {
Write-Host "Web Application:    " $_.Url
$sites = get-spsite -webapplication $_.Url -limit all;
foreach ($site in $sites) {
    foreach($web in $site.AllWebs)      {
        Write-Host "Applying to:            " $web.Url;

        $PagesLib = $web.Lists["Lib A"];

        if ($PagesLib -ne $null -and $PagesLib -is [Microsoft.SharePoint.SPDocumentLibrary])
        {
            Write-Host $Pageslib
            Write-Host "    Current visibility: " $PagesLib.DraftVersionVisibility;
            $PagesLib.DraftVersionVisibility = [Microsoft.SharePoint.DraftVisibilityType]::Reader;
            $PagesLib.Update();
            Write-Host "    New visibility:     " $PagesLib.DraftVersionVisibility;
        }

        $PagesLib = $web.Lists["Lib B"];

        if ($PagesLib -ne $null -and $PagesLib -is [Microsoft.SharePoint.SPDocumentLibrary])
        {
            Write-Host $Pageslib
            Write-Host "    Current visibility: " $PagesLib.DraftVersionVisibility;
            $PagesLib.DraftVersionVisibility = [Microsoft.SharePoint.DraftVisibilityType]::Reader;
            $PagesLib.Update();
            Write-Host "    New visibility:     " $PagesLib.DraftVersionVisibility;
        }

        $PagesLib = $web.Lists["Lib C"];

        if ($PagesLib -ne $null -and $PagesLib -is [Microsoft.SharePoint.SPDocumentLibrary])
        {
            Write-Host $Pageslib
            Write-Host "    Current visibility: " $PagesLib.DraftVersionVisibility;
            $PagesLib.DraftVersionVisibility = [Microsoft.SharePoint.DraftVisibilityType]::Reader;
            $PagesLib.Update();
            Write-Host "    New visibility:     " $PagesLib.DraftVersionVisibility;
        }

        $web.Dispose();
    }
    write-host "Finished:           "$site.Url;
    write-host "";
    $site.Dispose()
}
# Dispose site collection object
$_.Dispose()

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.