Tuesday, October 9, 2012

Get all users from web application in SharePoint using PowerShell

In this article we will discuss how to get list of all users in a web application using PowerShell in SharePoint 2010. You can also check this article for some powershell commands to work with SharePoint database.

We can retrive list of users inside a web application using PowerShell.

First Open PowerShell command window in Administrator mode. (Start -> All Programs -> Microsoft SharePoint 2010 Products and then Right click on SharePoint 2010 Management Shell)

Once it will open in Admin mode, type the command like below:

Get-SPWebApplication [Web application URL] | Get-SPSite | Get-SPWeb | Get-SPUser

Ex: Get-SPWebApplication http://bsahoo3:2500 | Get-SPSite | Get-SPWeb | Get-SPUser

Also you can try for each SPWeb object like below:

In the PowerShell command prompt type:

Get-SPUser
Then it will ask you to give the SPWeb name (as shown in the figure below)
Enter the web name like
 http://bsahoo3:2500/sites/TestSiteCollection

Then it will show the output of the list of users.

Check the figure below for both the commands.

No comments:

Post a Comment