PowerShell isn’t just a tool for Office 365 admins; it’s a game-changer. It unlocks efficiency, grants deep insights, and empowers you to take control of your environment. So, unleash the power within and discover how PowerShell can transform your Office 365 administration into a streamlined, efficient, and rewarding experience.
User Management:
- Get-MsolUser: Retrieves details about Office 365 users. For example, Get-MsolUser -Filter {Alias -eq “JohnDoe”} shows info for John Doe.
- Set-MsolUserPassword: Resets or sets a new password for a user. Use Set-MsolUserPassword -UserPrincipalName “JaneDoe@contoso.com” -NewPassword “StrongP@ssw0rd” to reset Jane’s password.
- Remove-MsolUser: Removes a user from your Office 365 tenant. Be cautious! Use Remove-MsolUser -UserPrincipalName “InactiveUser@contoso.com” with caution.
Group Management:
- Get-MsolGroup: Retrieves details about Office 365 security groups. Get-MsolGroup -Name “MarketingTeam” shows info for the Marketing Team group.
- Add-MsolGroupMember: Adds a user to a group. Add-MsolGroupMember -Group “SalesTeam” -Member “NewUser@contoso.com” adds NewUser to the Sales Team group.
- Remove-MsolGroupMember: Removes a user from a group. Use Remove-MsolGroupMember -Group “HR” -Member “LeavingEmployee@contoso.com” to remove a leaving employee.
SharePoint Online:
- Connect-SPOService: Connects to your SharePoint Online environment. Remember to run $cred = Get-Credential before this command for authentication.
- Get-SPOSite: Lists all SharePoint site collections in your tenant. Use Get-SPOSite | Where {$_.Url -like “https://contoso.sharepoint.com/*”} to filter by URL.
- Remove-SPOUser: Removes a user from all SharePoint sites in your tenant. Remove-SPOUser -LoginName “RetiredUser@contoso.com” removes the user from all sites.
Additional Utilities:
- Search-Mailbox: Searches email content across all mailboxes in your tenant. Powerful for investigating issues! Use Search-Mailbox -Identity “SuspiciousUser@contoso.com” -Keywords “Confidential” to search for keywords in a specific user’s mailbox.
Read more: Microsoft Learn https://learn.microsoft.com/en-us/powershell/