50 Useful Office 365 PowerShell Commands for Efficient Management

Here are 50 of the most useful Office 365 PowerShell commands:

  1. Connect to Office 365: Connect-MsolService
  2. Create a new user: New-MsolUser
  3. Add a license to a user: Set-MsolUserLicense
  4. Remove a license from a user: Set-MsolUserLicense -RemoveLicense
  5. Add a user to a distribution group: Add-DistributionGroupMember
  6. Remove a user from a distribution group: Remove-DistributionGroupMember
  7. Add a user to a security group: Add-MsolGroupMember
  8. Remove a user from a security group: Remove-MsolGroupMember
  9. Add a user to a SharePoint group: Add-SPOUser
  10. Remove a user from a SharePoint group: Remove-SPOUser
  11. Create a new SharePoint site: New-SPOSite
  12. Remove a SharePoint site: Remove-SPOSite
  13. Set a SharePoint site's permissions: Set-SPOSite
  14. Set a user's password: Set-MsolUserPassword
  15. Reset a user's password: Reset-MsolUserPassword
  16. Assign a role to a user: Add-MsolRoleMember
  17. Remove a role from a user: Remove-MsolRoleMember
  18. View a user's roles: Get-MsolRoleMember
  19. Create a new group: New-MsolGroup
  20. Remove a group: Remove-MsolGroup
  21. Set a group's properties: Set-MsolGroup
  22. View a group's members: Get-MsolGroupMember
  23. View a user's properties: Get-MsolUser
  24. View a user's licenses: Get-MsolUserLicense
  25. View a user's groups: Get-MsolUser -UserPrincipalName "user@domain.com" | Select -ExpandProperty ProxyAddresses
  26. View a user's roles: Get-MsolUser -UserPrincipalName "user@domain.com" | Select -ExpandProperty Roles
  27. View a user's SharePoint sites: Get-SPOUser
  28. View a user's OneDrive for Business site: Get-SPOSite -Identity "https://domain-my.sharepoint.com/personal/user_domain_com"
  29. View a user's Exchange mailbox: Get-Mailbox
  30. View a user's Outlook rules: Get-InboxRule
  31. Set an Exchange mailbox's properties: Set-Mailbox
  32. Set an Outlook rule's properties: Set-InboxRule
  33. View a user's calendar: Get-MailboxFolderStatistics -Identity user@domain.com:\calendar
  34. View a user's contacts: Get-MailboxFolderStatistics -Identity user@domain.com:\contacts
  35. View a user's tasks: Get-MailboxFolderStatistics -Identity user@domain.com:\tasks
  36. Create a new mailbox: New-Mailbox
  37. Remove a mailbox: Remove-Mailbox
  38. View a distribution group's properties: Get-DistributionGroup
  39. Set a distribution group's properties: Set-DistributionGroup
  40. View a security group's properties: Get-MsolGroup
  41. Set a security group's properties: Set-MsolGroup
  42. View a SharePoint site's properties: Get-SPOSite
  43. Set a SharePoint site's properties: Set-SPOSite
  44. View a SharePoint list's properties: Get-SPOList
  45. View a SharePoint library's properties: Get-SPODocumentLibrary
  46. Create a new SharePoint list: New-SPOList
  47. Create a new SharePoint library: New-SPODocumentLibrary
  48. Remove a SharePoint list: Remove-SPOList
  49. Remove a SharePoint library: Remove-SPODocumentLibrary
  50. Configure email forwarding for the user mailbox using the following command: Set-Mailbox -Identity "<UserPrincipalName>" -ForwardingAddress "<ExternalEmailAddress>" -DeliverToMailboxAndForward $falseNote: Replace <UserPrincipalName> with the user's email address and <ExternalEmailAddress> with the email address where you want to forward the emails. Verify the forwarding address is set correctly using the following command: Get-Mailbox -Identity "<UserPrincipalName>" | select *forward*To disable email forwarding, use the following command:Set-Mailbox -Identity "<UserPrincipalName>" -ForwardingAddress $null -DeliverToMailboxAndForward $false

Post a Comment

1 Comments

Emoji
(y)
:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
x-)
(k)