Monthly Archives: October 2013

I’m presenting at SharePoint Saturday Chicago on November 2nd

I’m thrilled to be part of SharePoint Saturday Chicago (http://www.sharepointsaturdaychicago.com/) on Saturday November 2nd.

I’ll be presenting a session called “SharePoint PowerShell Time Machine”

The idea behind the session is to share real-world scripts that can either allow you to go back in time (think in terms of recovery) or will save you time.

Update 11/4/2013 : The Slide deck, scripts and a PDF of the PowerShell CheatSheet are available here:  CourseMaterials_SPSChicago.zip

– Jack

Powershell to build a mailing list of every site owner in SharePoint

If you have any reason to communicate with your site owners, this script might be handy.

A few uses could be:

  • Communicate policy changes as they relate to SharePoint Site Owners
  • Communicate outage notifications to your site owners
  • Communicate upcoming training opportunities to your site owners.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$logfile = "c:\temp\SPOwnerEmailList_$(get-date -format `"yyyymmdd_hhmmtt`").txt"

$webapp = get-spwebapplication http://yourURL.com
$sites = $webapp.sites
$email = @("") #this sets up an empty array
foreach ($site in $sites)
{
   $weblist = $site.allwebs
   foreach ($web in $weblist)
   {
      $owners = $web.associatedownergroup
      foreach ($owner in $owners.users)
	  {
	     write-host "$($owner.email)  - $($web.AssociatedOwnerGroup.Name)"
	     $email = $email + $owner.email.ToLower() #this add's the current email address to the array
	  } 
	$web.dispose()	  
   } 
   $site.dispose()
}

#Sort the array and remove duplicates:
$email = $email | select -uniq | sort

foreach ($m in $email)
{
	"$m;" | out-file -filepath $logfile -append
}

#this just outputs how many email addresses there were to the screen:
$email | measure

The script creates a text file and it’s fairly easy to copy-> paste the results to Outlook.

I’m presenting at SharePoint Saturday Twin Cities!

I’m thrilled to be part of SharePoint Saturday Twin Cities (http://spstc.com) this coming weekend, Saturday October 12th.

I’ll be presenting a session called “SharePoint PowerShell Time Machine”

The idea behind the session is to share real-world scripts that can either allow you to go back in time (think in terms of recovery) or will save you time.

Update: If you attended my session and are interested in the slide deck, scripts and the SharePoint PowerShell Cheat Sheet, you can download them here: CourseMaterials