SharePoint 2010/2013 Powershell: Get SP User Properties of all the Site User or a Using Loginname
Here is how you fetch user properties/info using powershell. Normally to do that we use the following Powershell command but this required a SPUserPipeBind user identity which looks like this i:0#.w|domain\username
But incase you dont have SPUserPipeBind you can use the following script.
Now here comes the compelete script which took me couple of hours to build. For instance you are required to fetch all the users of the site along with their managers, following script is going to do the magic for you. What it does is to
Disclaimer: I don't completely own this script and the bad new is that I could not keep track of all the sources I followed. Still following are few of them:
http://stackoverflow.com/questions/3896258/how-to-output-text-without-newline-in-powershell
http://blog.incworx.com/blog/sharepoint-administrators-blog/get-a-users-id-using-powershell
http://sharepoint.stackexchange.com/questions/92017/get-user-by-loginname-using-powershell
Get-SPUser [[-Identity]] -Web [-AssignmentCollection ] [-Group ] [-Limit ]
But incase you dont have SPUserPipeBind you can use the following script.
Now here comes the compelete script which took me couple of hours to build. For instance you are required to fetch all the users of the site along with their managers, following script is going to do the magic for you. What it does is to
- Fetch all the User of a specific site collection.
- Loop through all the user and fetch each user's Manager
- Using $web.EnsureUser fetches Manager's Display name since Login Name is not that user friendly.
- At the end it takes all the users along with their respective Managers and sends them to a text file.
- Since the user names were in german in my case so the text file was encoded to [System.Text.Encoding]::Unicode. You can leave out the third argument while outputting things to text file if you don't need that.
Disclaimer: I don't completely own this script and the bad new is that I could not keep track of all the sources I followed. Still following are few of them:
http://stackoverflow.com/questions/3896258/how-to-output-text-without-newline-in-powershell
http://blog.incworx.com/blog/sharepoint-administrators-blog/get-a-users-id-using-powershell
http://sharepoint.stackexchange.com/questions/92017/get-user-by-loginname-using-powershell
Very useful properties Thanks SharePoint Migration Tool
ReplyDelete