Office365 Cmd Review

powershell Then connect to Microsoft 365:

m365 login m365 status m365 aad user list Get group members m365 aad o365group member list --groupId "group-id" Send email via Graph m365 outlook mail send --to "user@domain.com" --subject "Test" --body "Hello from CLI" 6. One-Liner Scripts (Batch + PowerShell) Save as m365_manage.cmd : office365 cmd

$securePassword = ConvertTo-SecureString "client_secret" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential ("app@client-id", $securePassword) Connect-MgGraph -AccessToken (Get-MsalToken -ClientId "client-id" -TenantId "tenant-id" -ClientSecret "secret").AccessToken | Issue | Fix | |-------|-----| | Connect-ExchangeOnline fails | Run as admin; check TLS: [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | | Graph auth errors | Request scopes explicitly: -Scopes "User.Read.All", "Mail.Send" | | Module not recognized | Install-Module -Name ModuleName -Force -AllowClobber | | Slow commands | Use -Top or -PageSize to limit results | 8. Quick Reference Card ┌─────────────────────┬──────────────────────────────────────────┐ │ Task │ Command │ ├─────────────────────┼──────────────────────────────────────────┤ │ Connect Exchange │ Connect-ExchangeOnline │ │ Connect Graph │ Connect-MgGraph │ │ List all users │ Get-MgUser -All │ │ Get user details │ Get-MgUser -UserId "user@domain.com" │ │ List groups │ Get-MgGroup │ │ Assign license │ Set-MgUserLicense │ │ Create user │ New-MgUser -DisplayName "..." ... │ │ Delete user │ Remove-MgUser -UserId "..." │ │ Get mailbox folders │ Get-EXOMailboxFolderStatistics │ │ Teams list │ Get-Team │ │ CLI login │ m365 login │ └─────────────────────┴──────────────────────────────────────────┘ Final Tip For daily admin tasks , use Microsoft Graph PowerShell SDK — it’s the future. For quick one-offs, CLI for Microsoft 365 works directly from CMD without PowerShell. powershell Then connect to Microsoft 365: m365 login

Save this post as a cheat sheet and adapt the commands to your tenant. │ │ Delete user │ Remove-MgUser -UserId "