The script is as follows:
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.
References
================================
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/