HI friends,

I am connected to M365 , I need your advise to fetch on excell bellow mentions items .
user Name,
user surname ,
user email adresse email
user 365 account
manager name
user last logon

How can I achieve this with or without powershell .

Thank you very much

2 Spice ups

The first few are easy:

That will give you plenty of examples.

You need to install Microsoft Graph first

Install-Module Microsoft.Graph -Scope CurrentUser

Connect to Microsoft Graph

Connect-MgGraph -Scopes 'User.Read.All'

From there you could do something like

Get-MgUser -UserId spicerex@spiceworks.com | fl

That will show you all the properties for that user.

Then just select the ones you want to return:

Get-MgUser -UserId adelev@lazydev.onmicrosoft.com | Select attrib1,attrib2,attrib3, etc.

Last logon is harder, you have to search a different log for that one.

4 Spice ups

Blockquote
Last logon is harder, you have to search a different log for that one.

Last logon can be retrieved with the same “User.Read.All” scope. For example:

$User = Get-MgUser -Property "signInActivity" -filter "userprincipalname eq 'username@domain.com' "
$User.signInActivity.LastSignInDateTime
3 Spice ups

Interesting, will have to try. I need to work more on my graph powershell modules, just haven’t had time with everything going on.

Manage Engine has a nice module that will give you tons on info (it’s not free) but it may be what you’re looking for. M365 Manager Plus

I don’t current use Admindroid, but I’ll throw a spice up on this. I did at another org, and it was a great product at a good price.

1 Spice up

ManageEngine has great reporting. Under the hood they are a bit of a mess but as far as the reporting and alerting goes, couldn’t ask for much more.

1 Spice up