Search This Blog

Thursday, January 9, 2014

How to get the databases that belonged to a specific User Profile Service Application in SharePoint 2010/2013

All of the User Profile Service Application databases for the User Profile Service Application object are marked as Internal properties, in other words, not easily accessible.

So how can we get the databases that belong to a particular User Profile Service Application? First, we need to know the properties that we’re after, and for that I always use the handy .NET Reflector. The properties for the User Profile Service Application Databases are:

1. ProfileDatabase

2. SocialDatabase

3. SynchronizationDatabase



#Get the named User Profile Service Application

$upsa = Get-SPServiceApplication | where {$_.Name -eq "User Profile Service Application"}

#Get the non-public Properties of the User Profile Service Application object

$propData = $upsa.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic)
 #Get the Social database Name, ID, and Type
$socialProp = $propData | where {$_.Name -eq "SocialDatabase"}
$socialProp.GetValue($upsa)
  #Get the Profile database Name, ID, and Type
$profileProp = $propData | where {$_.Name -eq "ProfileDatabase"}
$profileProp.GetValue($upsa)
  #Get the Sync database Name, ID, and Type
$syncProp = $propData | where {$_.Name -eq "SynchronizationDatabase"}
$syncProp.GetValue($upsa)

No comments:

Post a Comment