create a list of groups and the users in each group

As we all know, digging through SharePoint groups looking to see what users are in each, is no fun.

To solve this, I created a new List, and added the groups I wanted to monitor.  Then, added a little PowerShell to update a column in the List with the members in each group.


Create a new List.

New Columns:


Type: Person or Group

Allow selection of: People or Group


Type: Multiple lines of text

Specify the type of text to allow: 

Update Column:


Require that this column contains information: No

The PowerShell script below does the following:

Get the SharePoint Site and List.

Loop through each item in the List.

Retrieve the value of the SPgroup field.

Truncate the Users field.

Loop through the users in the SPgroup.

Update the Users field with the values from SPgroup.

if(-not(Get-PSSnapin | where { $_.Name -eq "Microsoft.SharePoint.PowerShell"}))
      Add-PSSnapin Microsoft.SharePoint.PowerShell;

$sSite = Get-SPweb ""
$sList=$sSite.Lists["SP Group Permissions"]
$i = 0

foreach($item in $sList.Items)
	$sFieldValue = $item["SPgroup"].ToString().Split('#')[1]
	$sGroup = $sSite.SiteGroups[$sFieldValue]

	If($sGroup.Users.Count -ge 0)
		$item["Users"] = ""

		foreach($usr in $sGroup.Users)
				if($i -eq 0)
					$item["Users"] = $usr.DisplayName
					$item["Users"] = $item["Users"] + ", " + $usr.DisplayName

Save the PowerShell script to your server.

Create a scheduled task to run the script hourly, daily, weekly, monthly…

Update Default Value of a Date and Time field

Ohhh how handy can PowerShell be!

I needed to change the default value of a Date and Time field for several hundred sites. PowerShell allowed me to update the field on all of my SharePoint sites in a matter of seconds.

#add-pssnapin microsoft.sharepoint.powershell


foreach ($web in $spsite.AllWebs) 

    Write-Host $
    $List = "List or Library"
    $OpenList = $web.Lists[$List]

    $Field = $OpenList.Fields["My Date Field"]
	$Field.DefaultValue = "[today]"