脚本如下:
Clear-Host
Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction "SilentlyContinue"
$url = "http://sps2010/"
$site = Get-SPSite $url
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$profiles = $profileManager.GetEnumerator()
while ($profiles.MoveNext()) {
$userProfile = $profiles.Current
$name = $userProfile.DisplayName
if($name -eq "Yunlong Zhang")
{
$phone = $userProfile["WorkPhone"]
$SipAddress = $userProfile["SPS-SipAddress"]
Write-Host $name
Write-Host $phone
Write-Host $SipAddress
}
}
My test result.
In SharePoint, we can see this value is displayed below.
参考资料
====================
Default user profile properties (SharePoint Server 2010)
http://technet.microsoft.com/en-us/library/hh147513.aspx
Access User Profile Properties from Powershell
http://sharepointkunskap.wordpress.com/2012/04/04/access-user-profile-properties-from-powershell/