Quantcast
Channel: The SharePoint Farm
Viewing all articles
Browse latest Browse all 184

PowerShell for People Picker Properties

0
0
As many SharePoint Administrators are aware, especially those dealing with one-way trusts or Selective trusts, the peoplepicker-* properties are very familiar to us. Since at least WSSv3, if not earlier, the peoplepicker-* properties have only been available via stsadm with no direct PowerShell replacement (it could be done, but it isn’t as pretty as ‘native’ PowerShell). For SharePoint 2010 and 2013, however, easier PowerShell-accessible properties were put into place. This allows the SharePoint Administrator to quickly configure these in a much more ‘modern’ way. Let’s say I need to configure the People Picker on a Web Application to filter out Groups. The classic way I would do this is: [crayon-52d8abbec341c133350697/] This property can be retrieved with [crayon-52d8abbec342c159359386-i/]. While you can still set the People Picker properties this way, the nice PowerShell way of doing it moving forward, taking the previous example, is: [crayon-52d8abbec3435758596150/] To remove it, we simply nullify it: [crayon-52d8abbec343e656928873/] This works with all of the properties displayed by [crayon-52d8abbec3446833681707-i/] except for SearchActiveDirectoryDomains (previous peoplepicker-searchadforests). For this particular property, we have to take some extra steps. First, use PowerShell to set the application credential key: [crayon-52d8abbec344f441424904/] This will set the key used to encrypt the credentials of the password we set for the user in the SearchActiveDirectoryDomains connection. Next, setup the connection: [crayon-52d8abbec3458926173998/] If you need to search multiple domains (or forests), just create more of the SPPeoplePickerSearchActiveDirectoryDomain objects and add them to [crayon-52d8abbec3461021633706-i/]. To revert the changes, you can either clear all entries via [crayon-52d8abbec3469194727565-i/], a specific entry by using the zero-based index, like so [crayon-52d8abbec3472484441768-i/] or alternatively, we can retrieve a specific entry by retrieving it, then removing it, like so: [crayon-52d8abbec347a212319765/] Unfortunately, TechNet, even for SharePoint 2013, still leads us down the way of using stsadm to set these People Picker Properties. But hopefully this gives you insight on how to do it in a more ‘modern’ way, to help you further retire the use of stsadm.

Viewing all articles
Browse latest Browse all 184

Latest Images

Trending Articles





Latest Images