Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Using PowerShell
>
SharePoint
Change Permissions on a document library
Last Post 24 Nov 2009 08:04 AM by
Alan Renouf
. 0 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
Alan Renouf
New Member
Posts:31
24 Nov 2009 08:04 AM
Hi, I currently have Sharepoint Portal 2003 & WSS 2.0.
I am working on a script that will:
a) enumerate the permissions on all document libraires on a group of sites (site names will be read from a text file)
b) modify permissions for all document libraries in the same group of sites
At the moment I can list the document libraries and the users and their permissions with the following code but I am getting very stuck with changing the permissions to give everyone read only permissions or even removing the users from the document library together.
Here is what I have at the moment:
## loads Sharepoint assembly
[System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
#sets site to work with
$siteurl = "http://test"
#creates mysite object / variable
$mysite=new-object Microsoft.Sharepoint.SPSite($siteurl)
#creates siteweb object / variable
$siteweb = $mysite.OpenWeb();
$listsnew = $siteweb.Lists
$doclibs = $siteweb.Folders | where {$_.ContainingDocumentLibrary -ne "00000000-0000-0000-0000-000000000000"}
foreach ($lib in ($doclibs | where {$_.name -eq "My test"})){
Write-Host $siteurl $siteweb
Write-Host "Document Library: " $lib.name
$mylist = $siteweb.Lists[$lib]
$mylist.Permissions
}
You are not authorized to post a reply.
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
Using PowerShell
>
SharePoint
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2