# 4. Apply the license Set-MgUserLicense -UserId $User.Id -BodyParameter $License
This guide covers the essentials. For advanced scripts, always refer to the official Microsoft Graph PowerShell documentation . office 365 cmd
Get-MgUser -All | Select-Object DisplayName, UserPrincipalName, Id, AccountEnabled | Export-Csv -Path "C:\Temp\Users.csv" -NoTypeInformation office 365 cmd
you want to automate (e.g., user onboarding, license reporting) Experience level with PowerShell Operating system you are using (Windows, macOS, or Linux) office 365 cmd
Only request the specific scopes (permissions) you need when connecting to Graph.