0

my english is not the best. But I hope you can understand me clearly.

To my question:

We have one SharePoint with many different SiteCollections with different users and permissions. Last week was decided that a specially AD-Group should add to all visitor-groups of all SiteCollections. How can I do that with PowerShell?

I am a beginner and tried many codes, but I not get it. Because every group has their own name -> Visitors of [-Name]. How is this implemented?

Summary:

  • One AD-Group shall be a member of each Visitor-Group of each SiteCollection (with different names).

In the best case the code can add exceptions for some SiteCollections. (But thats not a must).

I would be happy if you can help me. Thank you!

1

You can retrieve the default visitor group from a site by accessing this property:

https://docs.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.spweb.associatedvisitorgroup?view=sharepoint-server#Microsoft_SharePoint_SPWeb_AssociatedVisitorGroup

You would need to add the AD group to it and that should be it.

0

You can try this out .

Get your web application .

$web = Get-SPWeb "http://example.com"

Load all site collections under that web application .

$siteColls = Get-SPSite -webapplication $web -limit all

foreach($siteColl in $siteColls)

{

$siteCollWeb = Get-SPweb $siteColl.url

$visitorsGroup = $siteCollWeb.associatedVisitorsgroup

}

This will get you the default visitors group created by default when the site got created.

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.