11 Basic Powershell Office 365 Commands

1

Office 365 is a productivity application suite. This includes apps like Word, PowerPoint, or Excel. It is available on all devices. It has two versions, Personal and Home. The Personal Edition is designed for single users while the Home Edition is designed for more than one family member.

Quick outline:

powershell office 365 commands

conclusion

powershell office 365 commands

Powershell has a dedicated set of Office 365 commands. These commands help manage Office 365 operations.

1. Get-MsolUser

The Get-MsolUser command gets a person or a list of users from Azure Active Directory. Individual users can be retrieved by specifying the user by its ObjectID or UserPrincipalName parameter.

Example:

This example will yield a list of all Office 365 users:

To get all users from Azure Active Directory, first, use Get-MsolUser order and specify asterisk

,

2. New-MsolUser

The New-MsolUser command creates a new user account in the Active Directory domain. It is a part of the Azure Active Directory module.

Example:

This example will create a new user in Azure Active Directory: New-MsolUser -userprincipalname “userprincipalname” -display name “John Doe” -first name “John” -Surname

“Doe”

    • To create a new user in Azure Active Directory: First, keep
    • New-MsolUser Then, specify the main username
    • -userprincipalname After that, specify the display name -display name parameter, first name -first name parameters, and last name

-Surname

3. Set-MsolUserPassword

The Set-MsolUserPassword command resets the Office 365 user password. This cmdlet can be invoked only for users who have a standard identity.

Example:

This example will reset the Office 365 user account password: Set-MsolUserPassword -userprincipalname “userprincipalname” -New Password

“New Password”

    • To reset an Office 365 user account password: First, keep Set-MsolUserPassword Order and specify user's main name
    • -userprincipalname Then, specify the new password

-New Password

4. Delete-SPUser

This removes the user account from the SharePoint site collection. For example, it can remove a specific user or all users altogether from a group.

Example:

This example will remove a user from all SharePoint sites: Get-SPOsite , For each, Remove-SPOUser -site, .url -Login name“Login name or email”

,

    • To remove a user from all SharePoint sites: First, keep Get-SPOsite command and pipe it For each
    • Order Query. In the ForEach command query, first, put Remove-SPOUser command and then provide the site URL using
    • -site After that, provide login name or email

-Login name

5. Get-msolgroup

The Get-MsolGroup command gets a list of individuals or groups from Azure Active Directory. This gets the details of groups in Azure Active Directory. It outputs details such as display name, object ID and description.

Example:

This example will get all the groups in Azure Active Directory:

6. Add-MsolGroupMember

The Add-MsolGroupMember command adds a member or group as a member to an existing security group or site collection.

Example:

This example will add a new member to an existing group: Add-MsolGroupMember -GroupObjectID “group-object-id” -GroupMemberObjectID “group-member-object-id” -groupmembertype

“the user”

    • To add a member to a group: First, keep Add-MsolGroupMember Command and provide group object ID
    • -GroupObjectID Then, provide the group member object ID -GroupMemberObjectID parameters, and member types

-groupmembertype

7. Delete-MsoLGroupMember

Remove-MsoLGroupMember Removes a member from an existing security group or site collection.

Example:

This example will remove a user from a group:, group-id=get-msolgroup -search string

“group-member-name”

First, create a variable, get the specified group and store it in the variable:, userid=get-MsolUser -userprincipalname

“user-principal-name”

Create another variable, get the specified user and store it in the variable: Remove-MsoLGroupMember -GroupObjectID$group -Identification -Group member type the user -GroupMemberObjectID$user

-Identification
Finally, use Remove-MsoLGroupMember Permission. Then, specify the variable that stored the group value. After that, specify the user type -Group member type Parameter and assign it to the variable that stores user details -GroupMemberObjectID

Parameters.

8. Connect-MsolService

The Connect-MsolService command creates or initiates a connection with Azure Active Directory.

Example:

This example will connect to Office services: Connect-MsolService-Credentials<Office-365-example-certificate

,

    • To create a connection with Office 365 services: First, keep
    • Connect-MsolService Then, specify the credentials using

-certificate

9. New-Spice

The New-SPOSite command creates a SharePoint site collection list for an existing company. The creation of a SharePoint site collection will fail if a deleted site collection exists in the recycle bin.

Example:

This example will create a SharePoint site collection list: NEW-SPOCITE -url “sharepoint-site-url” -Owner “owner-email” -storagequota “2000” -Topic

“Presentation Title”

    • To create a new SharePoint sites collection: First, keep NEW-SPOCITE Command and specify SharePoint site URL
    • -url Then, specify the owner email by using -Owner Specify storage quota using parameters, and
    • -storagequota Finally, provide a title for the site collection

-Topic

10. Get-Mailbox

The get-mailbox command gets mailbox objects, such as quota settings, or email addresses.

Example 1:

This example will retrieve all mailbox reports: Get-Mailbox ,

Get Mailbox Statistics
To get the All Mailbox report, first, use Get-Mailbox command and pipe it Get Mailbox Statistics

Permission.

Example 2:

This example will retrieve complete mailbox details associated with the specified email address:

receive-mailbox email-address

To get mailbox details, simply provide the email address to the Get-Mailbox command.

11. Receive orders

The get-command command gets a list of cmdlets associated with the specified module. For example, it can receive Office 365 commands associated with the MSOnline module.

Example 1:

This example will find the commands associated with the MSOnline module: get-command -Modulus

msonline

    • To receive MSOnline orders: First, specify
    • get-command Then, specify msonline to the module

-Modulus

Example 2:

This example will provide commands associated with the AzureAD module: get-command -Modulus

AzureAD

    • Similarly, to get AzureAD command: First, specify
    • get-command Then, specify AzureAD to the module

-Modulus

conclusion

Office 365 includes productivity apps like Word, PowerPoint, or Outlook. Microsoft Office 365 can be managed through PowerShell. PowerShell has a set of dedicated commands to manage Office 365 operations. The most commonly used Office 365 commands include Get-MsolUser, New-MsolUser, Set-MsolUserPassword, or Remove-SPOUser.

Add comment

By Ranjan