Forum Discussion
jcasqueiro
Oct 13, 2023Brass Contributor
How to export list of all users with all the attributes
Hi, Does anyone have a PS script to export all the tenant users with all their attributes (including extended)? Thanks/Brgds joao PS: The Get-All_Students_and_Teachers.ps1 doesn't do the job b...
Paul_Wiegmans
Jun 18, 2024Copper Contributor
It should be possible somewhere along the lines like this:
Import-Module Microsoft.Graph.Authentication
Import-Module Microsoft.Graph.Users
Connect-MgGraph
$users = Get-MgUser -All -Property AccountEnabled, AdditionalProperties, CompanyName, CreatedDateTime, CreationType,
Department, DisplayName, EmployeeId, GivenName, Id, JobTitle,
LastPasswordChangeDateTime, Mail, MailNickname, OfficeLocation, PasswordPolicies,
PasswordProfile, ProxyAddresses, Surname, UsageLocation, UserPrincipalName, UserType,
extension_92c806d48fcc4740a5b5166f298e334e_extensionAttribute1,
extension_92c806d48fcc4740a5b5166f298e334e_extensionAttribute2,
ProxyAddresses
$users | Export-Csv -Path $output1 -Delimiter ";" -Encoding UTF8 -NoTypeInformation
Import-Module Microsoft.Graph.Authentication
Import-Module Microsoft.Graph.Users
Connect-MgGraph
$users = Get-MgUser -All -Property AccountEnabled, AdditionalProperties, CompanyName, CreatedDateTime, CreationType,
Department, DisplayName, EmployeeId, GivenName, Id, JobTitle,
LastPasswordChangeDateTime, Mail, MailNickname, OfficeLocation, PasswordPolicies,
PasswordProfile, ProxyAddresses, Surname, UsageLocation, UserPrincipalName, UserType,
extension_92c806d48fcc4740a5b5166f298e334e_extensionAttribute1,
extension_92c806d48fcc4740a5b5166f298e334e_extensionAttribute2,
ProxyAddresses
$users | Export-Csv -Path $output1 -Delimiter ";" -Encoding UTF8 -NoTypeInformation