I have used the below code for fetching the user profile from sharepoint 2010.Error I am getting is object $cm is returning as null.
$site = Get-SPSite($PortalURL); $servercontext = [Microsoft.Office.Server.ServerContext]::GetContext($site); $site.Dispose();
Return the UserProfileConfigManager
$cm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigmanager($servercontext); $spm = Get-SPProfileManager $siteUrl
Please help me to resolve this.I have开发者_高级运维 checked the user profile service and its up and ruuning.
I think you are disposing the connection before you should. Dispose at the end and you should be good
精彩评论