Audiences in SharePoint 2010: Get a hold on them via PowerShell

Audiences are part of a User Profile service application and they are used for content targeting in the SharePoint platform. By using them you can show WebPart just for a group of users (the audience). On the administrative level via the Central Administration users can be directed to their MySite home location via the 'My Site Host Location'. This is extremely useful in a global SharePoint architecture with regional SharePoint farms and users redirected to their regional My Site host.

Please find detailed information regarding the content targeting at and the 'My Site Host' at

In the following I would like to show a couple of PowerShell commands with which you can ge a hold on the audiences.

In SharePoint 2010 there is a AudienceManager object as part of the 'Audience Namespace' represents the entry point to the Audience feature in SharePoint 2010.

1. First you have to create an SPSite object

$SPSite = new-object Microsoft.SharePoint.SPSite(http://...)

2. Then you have to set up the server context

$srvCtx = [Microsoft.Office.Server.ServerContext]::GetContext($SPSite)

3. Finally we are ready to create the corresponding AudienceManager object

$auManager= new-object Microsoft.Office.Server.Audience.AudienceManager($srvContext)

4. Now we are ready to get a list of all audiences

$auManager.Audiences | fl



Comments (4)

  1. ralfgun says:

    Many thanks and changed accordingly.

  2. ImPoster says:

    Method in step 2 is GetContext as opposed to GetContent

  3. chuong says:

    I am having a problem with step #3

    $auManager= new-object Microsoft.Office.Server.Audience.AudienceManager($srvContext)

    New-Object : Exception calling ".ctor" with "0" argument(s): "Value cannot be n


    Parameter name: serviceContext"

    At line:1 char:23

    + $auManager= new-object <<<<  Microsoft.Office.Server.Audience.AudienceManager


       + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvoca


       + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power


  4. Rovinder Chopra says:

    It should really be:

    $auManager= new-object Microsoft.Office.Server.Audience.AudienceManager($srvCtx)

Skip to main content