I want to manually set my organization's leader in SharePoint, using the following script from TechNet. I modified the script to have the correct user profile service application proxy ID, and the correct username.
$upaProxy = Get-SPServiceApplicationProxy 1232b6f7-b9ff-99ad-0cd0-fg1g67h981aq
Add-SPProfileLeader -ProfileServiceApplicationProxy $upaProxy -Name "contoso\janedow"
Seems simple enough, but when I run the script I get an error: "Object reference not set to an instance of an object." What am I doing wrong?
EDIT: This turns out to have been a permissions issue. Once I logged in under an account with higher permissions, the script in my post ran successfully.