Share via


Can I use Get-SPUser and also display the email address

Question

Friday, April 12, 2013 5:31 PM

I have found a few users that don't have their email address in their SIP. I have in the past used ""Set-SPUser -Identity 'Domain\UserName' -web "http://fssp-02" –SyncFromAD"" to update it.

I would like to know if there is a way to use Get-SPUser -web "http://fssp-02" and display the email address along with the default columns UserLogin, DisplayName?

Stunpals - Disclaimer: This posting is provided "AS IS" with no warranties.

All replies (10)

Friday, April 12, 2013 6:14 PM ✅Answered | 1 vote

$user = Get-SPUser -Identity "domain\username" -Web http://siteCollection
$user | Select UserLogin,DisplayName,Email

SharePoint - Nauplius Applications
Microsoft SharePoint Server MVP
MCITP: SharePoint Administrator 2010

This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.


Friday, April 12, 2013 10:15 PM ✅Answered

http://sitecollUrl/_layouts/people.aspx?MembershipGroupId=0 will show all members of that site collection.

SharePoint - Nauplius Applications
Microsoft SharePoint Server MVP
MCITP: SharePoint Administrator 2010

This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.


Friday, April 12, 2013 6:24 PM

Thanks Trevor for the quick response. I have only used some basic commands in the SP PS and I am not clear if what you suggested is something I need to put into a script type file?

I ended up using "Get-SPUser -web "http://fssp-02" | select DisplayName,Email" which did what I wanted but I am interested in understanding how to use your suggestion correctly.

Sorry, PS beginner!

Stunpals - Disclaimer: This posting is provided "AS IS" with no warranties.


Friday, April 12, 2013 7:56 PM

What I posted allows you to get the user object and put it in a variable.  You can manipulate the object at that point, or obviously just output the properties.

You can see all available properties and methods by doing a $user | gm after setting the variable (which is what is done in the first line of what I posted).

SharePoint - Nauplius Applications
Microsoft SharePoint Server MVP
MCITP: SharePoint Administrator 2010

This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.


Friday, April 12, 2013 9:35 PM

I do follow that but what do I do to run this on the server?

If I type these lines into the PS console the syntax is wrong.

Get-SPUser : Cannot find an SPWeb object with Id or Url : http://siteCollection.At line:1 char:19+ $user = Get-SPUser <<<<  -Identity "domain\username" -Web http://siteCollection    + CategoryInfo          : InvalidData: (Microsoft.Share...SPCmdletGetUser:SPCmdletGetUser) [Ge   t-SPUser], SPCmdletPipeBindException    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetUser

I know its something I am doing wrong. I am assuming this needs to be in a script file or something?

Stunpals - Disclaimer: This posting is provided "AS IS" with no warranties.


Friday, April 12, 2013 9:36 PM

You need to specify your username and site collection URL, not what is in my example.

SharePoint - Nauplius Applications
Microsoft SharePoint Server MVP
MCITP: SharePoint Administrator 2010

This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.


Friday, April 12, 2013 9:38 PM

Ya, I was just doing that, forgot to change before pasting in to PS.

I see this gives me only the one user, can this be used to provide all users?

Stunpals - Disclaimer: This posting is provided "AS IS" with no warranties.


Friday, April 12, 2013 9:41 PM

I thinik I have it now, thanks Trevor

$user = Get-SPUser -Web http://siteCollection$user | Select UserLogin,DisplayName,Email

Stunpals - Disclaimer: This posting is provided "AS IS" with no warranties.


Friday, April 12, 2013 9:47 PM

I am seeing entries that have been deleted from AD that still show up in the Get-SPUser cmd.

I have poked around on the SPF server in People and Groups and can't seem to find where this is listed so I can remove it. Any idea where to find the list of all uses. I ad assuming I dont need to go site by site looking for them?

Stunpals - Disclaimer: This posting is provided "AS IS" with no warranties.


Thursday, January 2, 2020 2:26 PM

Hi,

I know its a old thread but if someone needs it. You can use -

- (Get-SPUser -Identity "domain\username" -Web "Site collection URL").email

Regards,

Preetam