Update a Secure Store Application information using PowerShell


*This will also work for SharePoint 2013 Preview*
You can use the following script to update information for one of your Secure Store Applications.
I want to change the Contact E-mail property for this Secure Store Application to "NewEmail@xxx.com"

Used Configuration
For this part, I have set up the following:

– 1 Web Application (My intranet)
– 1 Secure Store Service Application
– Created 1 Application: "TestID":

image

Pre-requisites
I found that before this works, you need the following:
– Site Collection Administrator for the root of the web application (my intranet)
– Full Control on the Secure Store Service Application. You can set this by going to:
Central Administration -> Application Management -> Manage Service Application -> Highlight the Secure Store Service Application -> Select "Administrators" from the ribbon.

image

Changing the desired property

#Add the PowerShell Snapin
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Retrieve the Service context
$site = new-object Microsoft.SharePoint.SPSite("https://demo.contoso.com");
$ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site);

#Get the Secure Store Application and save the new information into a variable
$Application = Get-SPSecureStoreApplication -Name "TestID" -ServiceContext $ServiceContext
$TargetApplication = $Application.TargetApplication
$TargetApplication.ContactEmail = "NewEmail@xxx.com"

#Set the saved information to the Target Application
Set-SPSecureStoreApplication -Identity $Application -TargetApplication $TargetApplication

Result

image

Advertisements

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