I am trying to perform some tasks on user profiles and so, need to connect with different permissions using an account created for that. And, I am doing this with Powershell.
Try {
$site = Get-SPSite $mySiteUrl
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
}
Catch {
"Error getting Get-SPSite"
$_
$site = $null
}
This produces an error:
Error getting Get-SPSite
Get-SPSite : Cannot access the local farm. Verify that the local farm is properly configured, currently available, and that you have the appropriate permissions to access the database before trying again.
At C:\scripts\ConnectScripts\TEAResumes\uploadTeaCvsToSharepoint.ps1:19 char:20
+ $site = Get-SPSite <<<< $mySiteUrl
+ CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletGetSite:SPCmdletGetSite) [Get-SPSite], SPCmdletException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite
So, I was wondering how authenticate with different creds?
Thanks