Skip to content

Get All Email Enabled Lists / Libraries in SharePoint 2007 With PowerShell .PS1 Script

by on May 22, 2014

STSADM Has Limitations – Use PowerShellimage

Use the normal PowerShell command app! stsadm cannot run .ps1 scripts, so save the below in a .ps1 file and call from PowerShell as you normally would.

Note: You will need admin permissions to db and server to run this.

  1. create getemailenabledlists.ps1 txt file and copy the below script into it (adjusted for your environment
  2. Open PowerShell (not stsadm or command prompt) and run as administrator
  3. call your new script
    • c:\user\username> c:\ps_scripts\getemailenabledlists.ps1
  4. wait for the script to complete
  5. Open, view, copy, import to excel, etc. the output file (I add the date to the end and leave it where it is.

NOTE: My script path happens to be c:\ps_scripts\ which is also where I wanted the files to save.

#Load SharePoint Asssemblies
[System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)

#sp2010
#$SPwebApp = Get-SPWebApplication  http://mysharepoint.com/
#sp2007
$SPWebApp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup(http://mysharepoint.com)

#create a CSV file 

"E-Mail,List,Site" > "C:\ps_scripts\EMail-Enabled.txt" #Write the Headers in to a text file

foreach ($SPsite in $SPwebApp.Sites)  # get the collection of site collections

{

foreach($SPweb in $SPsite.AllWebs)  # get the collection of sub sites

{

foreach ($SPList list in  $SPweb.Lists)

{

if ( ($splist.CanReceiveEmail) -and ($SPlist.EmailAlias) )

{

# WRITE-HOST "E-Mail -" $SPList.EmailAlias "is configured for the list "$SPlist.Title "in "$SPweb.Url

$SPList.EmailAlias + "," +  $SPlist.Title +"," + $SPweb.Url >> c:\ps_scripts\EMail-Enabled.txt  #append the data

}

}

}

}

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: