Export (0) Print
Expand All
0 out of 5 rated this helpful - Rate this topic

Use Windows PowerShell to update alerts in SharePoint 2013

Updated: March 12, 2013

Summary: Learn to use Invoke-AlertFixup to update the e-mail alerts associated with a URL.

Applies to:  SharePoint Foundation 2013 | SharePoint Server 2013 

This article describes Invoke-AlertFixup, a Windows PowerShell advanced function that you can use to update the Uniform Resource Locator (URL) of a Web application used in alert e-mails after a Web application address changes. The advanced function is loaded by running a script of the same name.

For more information about advanced functions, see about_Functions_Advanced.

In this article:

Before you begin

Because SharePoint 2013 runs as websites in Internet Information Services (IIS), administrators and users depend on the accessibility features that browsers provide. SharePoint 2013 supports the accessibility features of supported browsers. For more information, see the following resources:

Before you begin this operation, read about_Execution_Policies.

Update URLs by using Windows PowerShell

This section describes how to update URLs by using Windows PowerShell.

To update URLs by using Windows PowerShell

  1. Verify that you have the following memberships:

    • securityadmin fixed server role on the SQL Server instance.

    • db_owner fixed database role on all databases that are to be updated.

    • Administrators group on the server on which you are running the Windows PowerShell cmdlets.

    An administrator can use the Add-SPShellAdmin cmdlet to grant permissions.

    note Note:

    If you do not have permissions, contact your Setup administrator or SQL Server administrator to request permissions. For additional information about Windows PowerShell permissions, see Add-SPShellAdmin.

  2. Copy the code from the Script Center (http://go.microsoft.com/fwlink/p/?LinkId=196687), and then paste it into a text editor, such as Notepad.

  3. Save the file, naming it Invoke-AlertFixup.ps1.

    note Note:

    You must use the provided name or the script will fail, and you must save the file as an ANSI-encoded text file.

  4. On the Start menu, click All Programs.

  5. Click Microsoft SharePoint 2013 Products.

  6. Click SharePoint 2013 Management Shell.

  7. Change to the directory where you saved the file.

  8. At the Windows PowerShell command prompt, type the following command:

    ./Invoke-AlertFixup.ps1
    

    This script contains the Invoke-AlertFixup advanced function. After the script is loaded to memory for the current Windows PowerShell session, Invoke-AlertFixup can be used like a Windows PowerShell cmdlet, for example:

    Invoke-AlertFixup -site <SiteCollURL> -oldurl <OldURL>
    

    Where:

    • <SiteCollURL> is the Site Collection URL seen in the ImmedSubscriptions table of the content database.

    • <OldURL> is the old URL of the site.

    noteNote:

    For Invoke-AlertFixup to work correctly, the URLs that you specify with the site and oldurl parameters must be in the same site collection. This is necessary to allow necessary updating of alerts in a specific zone. Alerts for each zone must be updated individually using the necessary new zone URL to that of the original (old) zone URL.

  9. To display all alerts that would be updated by using the Invoke-AlertFixup command, at the Windows PowerShell command prompt type the following:

    Invoke-AlertFixup -site <SiteCollURL> -Oldurl <OldURL> -whatif
    

    Where:

    • <SiteCollURL> is the Site Collection URL seen in the ImmedSubscriptions table of the content database.

    • <OldURL> is the old URL of the site.

For more information, see Script Center.

note Note:

We recommend that you use Windows PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.

Example

Your company has a web application that is configured to use three zones, as shown in the following table.

Coho Winery zone mapping

Description URL Zone

Intranet

http://cohowinery

Default

Extranet

http://extranet.cohowinery.com

Extranet

Vendor

http://vendors.cohowinery.com

Custom

Your company merges with Coho Vineyard and changes its name to Coho Winery and Vineyard. Management wants to change the Intranet and Extranet zones to reflect the new name change. The following table displays the new zone configuration.

Coho Winery and Vineyard zone mapping

Description URL Zone

Intranet

http://cohovineyardandwinery

Default

Extranet

http://extranet.cohovineyardandwinery.com

Extranet

After the name of the web application is changed and the alternate access mappings are updated, Invoke-AlertFixup should be run to update the e-mail alerts associated with the intranet and extranet sites, as follows:

Invoke-AlertFixup -site http://cohovineyardandwinery -oldurl http://cohowinery
Invoke-AlertFixup -site http://extranet.cohovineyardandwinery.com -oldurl http://extranet.cohowinery.com
noteNote:

No changes are made regarding the vendor site, as Coho Winery has decided not to change the name of the vendor portal.

Change History

Date Description

March 12, 2013

Updated the parameters of the Invoke-AlertFixup command.

October 16, 2012

Initial publication

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.