To get a list of all users of a SharePoint web application in PowerShell, we can use get-spuser cmdlet. This cmdlet should be used with SPWeb object.
To get all users in a web application use this PowerShell command. It will include all users in all site collections of web application.
Get-SPWebApplication http://sp2010:2000 | Get-SPSite | Get-SPWeb | Get-SPUser
UserLogin DisplayName
--------- -----------
DS\expsah DS\expsah
SHAREPOINT\system System Account
DS\expsah DS\expsah
NT AUTHORITY\auth... NT AUTHORITY\auth
NT AUTHORITY\LOCA... Salman Mn1 Ahmad
SHAREPOINT\system System Account
DS\expsah DS\expsah
NT AUTHORITY\auth... NT AUTHORITY\auth
NT AUTHORITY\LOCA... Salman Mn1 Ahmad
SHAREPOINT\system System Account
DS\expsah DS\expsah
NT AUTHORITY\auth... NT AUTHORITY\auth
NT AUTHORITY\LOCA... Salman Mn1 Ahmad
SHAREPOINT\system System Account
This is great. May I recommend using "-Limit All" on spsite, spweb, and spuser? This will cover you if you have thousands and thousands. So you example will look like this:
ReplyDeleteGet-SPWebApplication http://sp2010:2000 | Get-SPSite -Limi tAll | Get-SPWeb -Limit All | Get-SPUser -Limit All
There will be a lot of duplicates.. but then you could deal with that by playing with "Get-Unique"
Thanks!