Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
- $caURL = (Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript {
- $_.IsAdministrationWebApplication -eq $true
- }).Url
- $context = Get-SPServiceContext -Site $caURL
- $userProfileConfigManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" `
- -ArgumentList $context
- $connection = $userProfileConfigManager.ConnectionManager["AD"]
- if($connection.Type -eq "ActiveDirectoryImport")
- {
- $adImportConnection = [Microsoft.Office.Server.UserProfiles.ActiveDirectoryImportConnection]$connection
- $propertyFlags = [System.Reflection.BindingFlags]::Instance -bor `
- [System.Reflection.BindingFlags]::NonPublic
- $propMembers = $adImportConnection.GetType().GetMethods($propertyFlags)
- $adImportPropertyMappingsMethod = $propMembers | Where-Object -FilterScript {
- $_.Name -eq "ADImportPropertyMappings"
- }
- $propertyMappings = $adImportPropertyMappingsMethod.Invoke($adImportConnection,$null)
- $propertyMappings | ForEach-Object -Process {
- $currentMappingMembers = $_.GetType().GetMembers($propertyFlags)
- $profileProperty = $currentMappingMembers | Where-Object -FilterScript {
- $_.Name -eq "ProfileProperty"
- }
- $profilePropertyValue = $profileProperty.GetValue($_)
- if($profilePropertyValue -eq "SPS-ClaimID")
- {
- $adAttributeProperty = $currentMappingMembers | Where-Object -FilterScript {
- $_.Name -eq "ADAttribute"
- }
- Write-Host "ADAttribute : $($adAttributeProperty.GetValue($_))"
- Write-Host "MappingDirection : Import"
- }
- }
- }
Add Comment
Please, Sign In to add comment