1

I have used the below

Get-SPWebApplication http://site | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID,AssociatedMemberGroup,AssociatedOwnerGroup | Export-CSV C:\InfoArch.csv -NoTypeInformation

to list out title,url etc..of a site collection and subsite. But how can i get the list of users in the AssociatedMemberGroup,AssociatedOwnerGroup, I can get the group but i want the user listed in my excelsheet e.g James Bond, Hulk Hogan etc..

I guess can i loop through the property collection to retrieve ths values in my powerssell above?

Also is it also possible to identify if there list with infopath forms in a site?

Thanks in Advance

  • When exporting to a CSV, you get a single row of data. How do you want to represent 500 users found in a Members group? – Mike Smith - MCT - MVP Mar 20 '18 at 17:23
1

Try the below script

 $userarray = @()
  $fth = "C:\User.csv"

  $wp = Get-SPWebApplication
  foreach($sw in $wp){
   foreach($sst in $wp.sites)
   {

    foreach($sweb in $sst.AllWebs)
    {
        $op = New-Object PSObject

        [string]$amgu =$sweb.AssociatedMemberGroup.Users.DisplayName 
        [string]$aogu = $sweb.AssociatedOwnerGroup.Users.DisplayName
        $op | Add-Member NoteProperty -name "Title" -Value $sweb.Title
        $op | Add-Member NoteProperty -name "URL" -Value $sweb.Url
        $op | Add-Member NoteProperty -name "ID" -Value $sweb.ID
        $op | Add-Member NoteProperty -name "ParentWeb" -Value $sweb.ParentWeb
        $op | Add-Member NoteProperty -name "ParentWebId" -Value $sweb.ParentWebID
        $op | Add-Member NoteProperty -name "AssociatedMemberGroup" -Value $amgu
        $op | Add-Member NoteProperty -name "AssociatedOwnerGroup" -Value $aogu 
        $userarray += $op

    }
   }
  }
  $userarray |  Export-Csv $fth -NoTypeInformation

This will give you Title, URL, ID, Parent web and Users in both groups. each web in a single row....AssociatedOwner Group column contains all users in single cell.

  • Cheers Waqas.Will test and let you know – naijacoder Mar 21 '18 at 3:48
1

Here's a quick solution, but the group members will all be in one column.

Get-SPWebApplication http://site | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID,AssociatedMemberGroup, {$_.AssociatedMemberGroup.Users}, AssociatedOwnerGroup, {$_.AssociatedOwnerGroup.Users} | ConvertTo-Csv

Here's a sample result:

"Sales Team Site","http://site","00000000-661b-489f-af9a-6c8490dafb7c","00000000-0000-0000-0000-000000000000","Sales Team Site Members","i:0#.w|spdemo\richardm i:0#.w|spdemo\samc c:0+.w|s-1-5-21-492373370-1002446965-3707187856-1124 i:0#.w|spdemo\stellas i:0#.w|spdemo\susanj","Sales Team Site Owners","i:0#.w|spdemo\administrator"
1

Since you are using PnP, there is a PowerShell command to get group members.

Get-PnPGroupMembers -Identity <GroupPipeBind>

As you indicated that, you are able to get the group name, you can use that to get the group object and pass it to the above command to get all the members.

Store them in an array and output it to a csv in the end.

0

Updated... better answer here:

http://www.sharepointdiary.com/2016/01/find-all-infopath-list-forms-in-sharepoint-using-powershell.html

And here is a shorter version:

Get-SPWebApplication http://site | 
Get-SPSite -Limit All | 
Get-SPWeb -Limit All |
Select -ExpandProperty Lists |
Where { $_.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"]  } | 
Select Title, {$_.ParentWeb.Url}

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.