Add Properties to Get-MgUser cmdlets similar to Get-MsolUser

Add Properties to Get-MgUser cmdlets similar to Get-MsolUser
2

Upvotes

Upvote

 May 11 2022
1 Comments (1 New)
New

@Pernille-Eskebo:

The cmdlet 'Get-MsolUser' has properties for Licenses.AccountSkuID and BlockCredential where we can pipe them in a single-line command:
Get-MsolUser -All | Where-Object { $_.BlockCredential -eq $true -and $_.Islicensed -eq $true -and $_.Licenses.AccountSkuid -cmatch "SPE_E5" }

Please add similar properties to Get-MgUser cmdlet too. We need this for email reporting of extracting offboarded users with M365 licenses assigned and auto-remove them using PowerShell script. Without these properties, they are much harder to implement and prone to errors.

See sample output of Get-MgUser :
Properties 'AccountEnabled' and 'AssignedLicenses' are EMPTY :(

PS C:\Windows\system32> Get-MgUser -UserId caignacio@corp.archcapservices.com | fl


AboutMe                               :
AccountEnabled                        :
Activities                            :
AgeGroup                              :
AgreementAcceptances                  :
AppRoleAssignments                    :
AssignedLicenses                      :
AssignedPlans                         :
Authentication                        : Microsoft.Graph.PowerShell.Models.MicrosoftGraphAuthentication1
Birthday                              :
BusinessPhones                        : {(212) 271-8318}
Calendar                              : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCalendar1
CalendarGroups                        :
CalendarView                          :
Calendars                             :
Chats                                 :
City                                  :
CompanyName                           :
ConsentProvidedForMinor               :
ContactFolders                        :
Contacts                              :
Country                               :
CreatedDateTime                       :
CreatedObjects                        :
CreationType                          :
DeletedDateTime                       :
Department                            :
DeviceEnrollmentLimit                 :
DeviceManagementTroubleshootingEvents :
DirectReports                         :
DisplayName                           : Ignacio, Camille
Drive                                 : Microsoft.Graph.PowerShell.Models.MicrosoftGraphDrive1
Drives                                :
EmployeeHireDate                      :
EmployeeId                            :
EmployeeOrgData                       : Microsoft.Graph.PowerShell.Models.MicrosoftGraphEmployeeOrgData
EmployeeType                          :
Events                                :
Extensions                            :
ExternalUserState                     :
ExternalUserStateChangeDateTime       :
FaxNumber                             :
FollowedSites                         :
GivenName                             : Camille
HireDate                              :
Id                                    : 8f805d7d-a9ed-4bc2-9af2-60594a56c222
Identities                            :
ImAddresses                           :
InferenceClassification               : Microsoft.Graph.PowerShell.Models.MicrosoftGraphInferenceClassification
Insights                              : Microsoft.Graph.PowerShell.Models.MicrosoftGraphOfficeGraphInsights
Interests                             :
IsResourceAccount                     :
JobTitle                              : Service Desk Analyst - Level II
JoinedTeams                           :
LastPasswordChangeDateTime            :
LegalAgeGroupClassification           :
LicenseAssignmentStates               :
LicenseDetails                        :
Mail                                  : caignacio@archgroup.com
MailFolders                           :
MailNickname                          :
MailboxSettings                       : Microsoft.Graph.PowerShell.Models.MicrosoftGraphMailboxSettings1
ManagedAppRegistrations               :
ManagedDevices                        :
Manager                               : Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject
MemberOf                              :
Messages                              :
MobilePhone                           :
MySite                                :
Oauth2PermissionGrants                :
OfficeLocation                        : PHL-Manila
OnPremisesDistinguishedName           :
OnPremisesDomainName                  :
OnPremisesExtensionAttributes         : Microsoft.Graph.PowerShell.Models.MicrosoftGraphOnPremisesExtensionAttributes
OnPremisesImmutableId                 :
OnPremisesLastSyncDateTime            :
OnPremisesProvisioningErrors          :
OnPremisesSamAccountName              :
OnPremisesSecurityIdentifier          :
OnPremisesSyncEnabled                 :
OnPremisesUserPrincipalName           :
Onenote                               : Microsoft.Graph.PowerShell.Models.MicrosoftGraphOnenote1
OnlineMeetings                        :
OtherMails                            :
Outlook                               : Microsoft.Graph.PowerShell.Models.MicrosoftGraphOutlookUser1
OwnedDevices                          :
OwnedObjects                          :
PasswordPolicies                      :
PasswordProfile                       : Microsoft.Graph.PowerShell.Models.MicrosoftGraphPasswordProfile
PastProjects                          :
People                                :
Photo                                 : Microsoft.Graph.PowerShell.Models.MicrosoftGraphProfilePhoto
Photos                                :
Planner                               : Microsoft.Graph.PowerShell.Models.MicrosoftGraphPlannerUser1
PostalCode                            :
PreferredLanguage                     :
PreferredName                         :
Presence                              : Microsoft.Graph.PowerShell.Models.MicrosoftGraphPresence1
ProvisionedPlans                      :
ProxyAddresses                        :
RegisteredDevices                     :
Responsibilities                      :
Schools                               :
ScopedRoleMemberOf                    :
Settings                              : Microsoft.Graph.PowerShell.Models.MicrosoftGraphUserSettings1
ShowInAddressList                     :
SignInSessionsValidFromDateTime       :
Skills                                :
State                                 :
StreetAddress                         :
Surname                               : Ignacio
Teamwork                              : Microsoft.Graph.PowerShell.Models.MicrosoftGraphUserTeamwork1
Todo                                  : Microsoft.Graph.PowerShell.Models.MicrosoftGraphTodo
TransitiveMemberOf                    :
UsageLocation                         :
UserPrincipalName                     : CAIgnacio@corp.archcapservices.com
UserType                              :
AdditionalProperties                  : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#users/$entity]}

 

Comments
Copper Contributor

I have the same problems and it will be great to have a similar properties BlockCredential, Islicensed, etc.  in Get-MgUser cmdlet