Granting the “Retrieve People Data for Search Crawlers” administration permission on the User Profile Service Application using PowerShell

When working with search-driven solutions, or even if you just want to be able to search for people, SharePoint Search has to be granted access to that information in order to crawl it. Generally all of this is being automatically taken care of when provisioning the Search Service Application. On rare occasions you might however need to grant this permission manually.