Guest User

Untitled

a guest
Jun 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
  2.  
  3. $caURL = (Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript {
  4. $_.IsAdministrationWebApplication -eq $true
  5. }).Url
  6. $context = Get-SPServiceContext -Site $caURL
  7. $userProfileConfigManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" `
  8. -ArgumentList $context
  9. $connection = $userProfileConfigManager.ConnectionManager["AD"]
  10. if($connection.Type -eq "ActiveDirectoryImport")
  11. {
  12. $adImportConnection = [Microsoft.Office.Server.UserProfiles.ActiveDirectoryImportConnection]$connection
  13.  
  14. $propertyFlags = [System.Reflection.BindingFlags]::Instance -bor `
  15. [System.Reflection.BindingFlags]::NonPublic
  16.  
  17. $propMembers = $adImportConnection.GetType().GetMethods($propertyFlags)
  18.  
  19. $adImportPropertyMappingsMethod = $propMembers | Where-Object -FilterScript {
  20. $_.Name -eq "ADImportPropertyMappings"
  21. }
  22. $propertyMappings = $adImportPropertyMappingsMethod.Invoke($adImportConnection,$null)
  23.  
  24. $propertyMappings | ForEach-Object -Process {
  25. $currentMappingMembers = $_.GetType().GetMembers($propertyFlags)
  26.  
  27. $profileProperty = $currentMappingMembers | Where-Object -FilterScript {
  28. $_.Name -eq "ProfileProperty"
  29. }
  30.  
  31. $profilePropertyValue = $profileProperty.GetValue($_)
  32. if($profilePropertyValue -eq "SPS-ClaimID")
  33. {
  34. $adAttributeProperty = $currentMappingMembers | Where-Object -FilterScript {
  35. $_.Name -eq "ADAttribute"
  36. }
  37.  
  38. Write-Host "ADAttribute : $($adAttributeProperty.GetValue($_))"
  39. Write-Host "MappingDirection : Import"
  40. }
  41. }
  42. }
Add Comment
Please, Sign In to add comment