Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Null Valued Express importing LDAP attribute

$
0
0

I get this trying to run my script. What it is doing is adding a custom LDAP attribute to SharePoint property so I can manage it.

Cannot determine the issue. There are checks in the code to let me know if successful but the last part is not.

Add-PSSnapin Microsoft.Sharepoint.Powershell
$url = "http://sp-appXXX:2013" #URL of any site collection that is associated to the user profile service 

application. 
$spsProperty = "RoomNumber" #Internal name of the SharePoint user profile property 
$fimProperty = "extensionAttribute2" #Name of the attribute in FIM/LDAP source 
$connectionName = "LDAP Sync" #Name of the SharePoint synchronization connection 

$site = Get-SPSite $url 

if ($site) 
{Write-Host "Successfully obtained site reference!"} 
else 
{Write-Host "Failed to obtain site reference"} 

$serviceContext = Get-SPServiceContext($site) 

if ($serviceContext) 
{Write-Host "Successfully obtained service context!"} 
else 
{Write-Host "Failed to obtain service context"} 
$upManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($serviceContext) 

if ($upManager) 
{Write-Host "Successfully obtained user profile manager!"} 
else 
{Write-Host "Failed to obtain user profile manager"} 
$synchConnection = $upManager.ConnectionManager[$connectionName] 

if ($synchConnection) 
{Write-Host "Successfully obtained synchronization connection!"} 
else 
{Write-Host "Failed to obtain user synchronization connection!"} 

Write-Host "Adding the attribute mapping..." 
$synchConnection.PropertyMapping.AddNewMapping([Microsoft.Office.Server.UserProfiles.ProfileType]::User, 

$spsProperty, $fimProperty) 
Write-Host "Done!" 


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>