Showing posts with label M365. Show all posts
Showing posts with label M365. Show all posts

Monday, May 25, 2026

Microsoft 365 Workloads – Daily Used PowerShell Commands

 Microsoft 365 Workloads – Daily Used PowerShell Commands

As an M365 Administrator, SharePoint Administrator, or Collaboration Engineer, these are the most frequently used PowerShell commands across major Microsoft 365 workloads.

 

1. Microsoft Entra ID (Azure AD)

Module:

Microsoft.Graph

Connect

Connect-MgGraph -Scopes "User.Read.All","Group.Read.All"

Get Users

Get-MgUser

Get Specific User

Get-MgUser -UserId user@contoso.com

Create User

New-MgUser

Disable User

Update-MgUser -UserId user@contoso.com -AccountEnabled:$false

Get Groups

Get-MgGroup

Add User to Group

New-MgGroupMember

Remove User from Group

Remove-MgGroupMemberByRef

Get Licenses

Get-MgSubscribedSku

Assign License

Set-MgUserLicense

 

2. SharePoint Online

SharePoint Online

Module:

Microsoft.Online.SharePoint.PowerShell
PnP.PowerShell

Connect

Connect-SPOService -Url https://tenant-admin.sharepoint.com

Get Tenant Settings

Get-SPOTenant

Get All Sites

Get-SPOSite -Limit All

Create Site

New-SPOSite

Remove Site

Remove-SPOSite

Restore Site

Restore-SPODeletedSite

Get Site Admins

Get-SPOUser

Set Site Collection Admin

Set-SPOUser

Lock Site

Set-SPOSite -LockState ReadOnly

External Sharing

Set-SPOSite -SharingCapability Disabled

 

PnP PowerShell

Connect

Connect-PnPOnline -Url https://tenant.sharepoint.com -Interactive

Get Libraries

Get-PnPList

Create Library

New-PnPList

Upload File

Add-PnPFile

Download File

Get-PnPFile

Create Column

Add-PnPField

Create Content Type

Add-PnPContentType

 

3. Exchange Online

Exchange Online

Module:

ExchangeOnlineManagement

Connect

Connect-ExchangeOnline

Get Mailboxes

Get-Mailbox

Get Mailbox Statistics

Get-MailboxStatistics

Create Shared Mailbox

New-Mailbox -Shared

Get Shared Mailboxes

Get-Mailbox -RecipientTypeDetails SharedMailbox

Add Mailbox Permission

Add-MailboxPermission

Remove Mailbox Permission

Remove-MailboxPermission

Create Distribution Group

New-DistributionGroup

Get Distribution Groups

Get-DistributionGroup

Add Group Member

Add-DistributionGroupMember

Mail Trace

Get-MessageTrace

Mail Flow Rules

Get-TransportRule

 

4. Microsoft Teams

Microsoft Teams

Module:

MicrosoftTeams

Connect

Connect-MicrosoftTeams

Get Teams

Get-Team

Create Team

New-Team

Add User

Add-TeamUser

Remove User

Remove-TeamUser

Get Team Members

Get-TeamUser

Get Channels

Get-TeamChannel

Create Channel

New-TeamChannel

Get Teams Policies

Get-CsTeamsMeetingPolicy

 

5. OneDrive for Business

OneDrive for Business

Uses SPO commands because OneDrive is built on SharePoint.

Get OneDrive Sites

Get-SPOSite -IncludePersonalSite $true

Get Specific OneDrive

Get-SPOSite -Identity https://tenant-my.sharepoint.com/personal/user

Set Storage Quota

Set-SPOSite

Restore OneDrive

Restore-SPODeletedSite

 

6. Microsoft Purview (Compliance Center)

Microsoft Purview

Module:

ExchangeOnlineManagement
IPPSSession

Connect

Connect-IPPSSession

Get Retention Policies

Get-RetentionCompliancePolicy

Get Retention Labels

Get-ComplianceTag

Get DLP Policies

Get-DlpCompliancePolicy

Get DLP Rules

Get-DlpComplianceRule

Content Search

Get-ComplianceSearch

Start Search

Start-ComplianceSearch

Audit Log Search

Search-UnifiedAuditLog

 

7. Microsoft Intune

Microsoft Intune

Module:

Microsoft.Graph

Connect

Connect-MgGraph

Managed Devices

Get-MgDeviceManagementManagedDevice

Compliance Policies

Get-MgDeviceManagementDeviceCompliancePolicy

Configuration Profiles

Get-MgDeviceManagementDeviceConfiguration

Remote Wipe

Invoke-MgDeviceManagementManagedDeviceWipe

 

8. Power Platform

Power Apps

Module:

Microsoft.PowerApps.Administration.PowerShell

Connect

Add-PowerAppsAccount

Get Apps

Get-AdminPowerApp

Get Environments

Get-AdminPowerAppEnvironment

Get Connectors

Get-AdminPowerAppConnector

 

9. Power Automate

Get Flows

Get-AdminFlow

Get Flow Details

Get-Flow

Disable Flow

Disable-AdminFlow

 

10. Microsoft 365 Groups

Get Groups

Get-UnifiedGroup

Create Group

New-UnifiedGroup

Add Member

Add-UnifiedGroupLinks

Remove Member

Remove-UnifiedGroupLinks

 

11. Licensing

View Licenses

Get-MgSubscribedSku

View User Licenses

Get-MgUserLicenseDetail

Assign License

Set-MgUserLicense

Remove License

Set-MgUserLicense

 

12. Security & Defender

Microsoft Defender for Office 365

Connect

Connect-ExchangeOnline

Safe Attachments

Get-SafeAttachmentPolicy

Safe Links

Get-SafeLinksPolicy

Anti-Spam Policies

Get-HostedContentFilterPolicy

Quarantine Messages

Get-QuarantineMessage

 

Daily Commands Used Most by M365 Administrators

Workload

Daily Commands

Entra ID

Get-MgUser, Get-MgGroup, Set-MgUserLicense

SharePoint Online

Get-SPOSite, Get-SPOUser, Set-SPOSite

Exchange Online

Get-Mailbox, Get-MessageTrace, Add-MailboxPermission

Teams

Get-Team, Add-TeamUser, Get-TeamChannel

OneDrive

Get-SPOSite -IncludePersonalSite

Purview

Search-UnifiedAuditLog, Get-DlpCompliancePolicy

Intune

Get-MgDeviceManagementManagedDevice

Power Apps

Get-AdminPowerApp

Power Automate

Get-AdminFlow

Licensing

Get-MgSubscribedSku

Security

Get-QuarantineMessage


Basics of Microsoft 365 (M365) Workloads

 Basics of Microsoft 365 (M365) Workloads 

Microsoft 365 (M365) Workloads

Microsoft 365 (M365) is a cloud-based productivity, collaboration, security, and compliance platform from Microsoft. A workload in M365 refers to a specific service or application designed for a particular business function.

Think of M365 as a large office building:

  • Exchange Online = Email Department
  • SharePoint Online = Document Management Department
  • OneDrive = Personal File Storage
  • Teams = Communication Hub
  • Power Platform = Automation Department
  • Purview = Compliance & Governance Department
  • Entra ID = Identity & Access Department

 

1. Exchange Online

Purpose

Provides enterprise email, calendaring, contacts, and task management.

Examples

  • Employee email accounts
  • Meeting scheduling
  • Shared mailboxes
  • Resource mailboxes (conference rooms)

Real-Time Scenario

A pharmaceutical company uses Exchange Online for:

Features

  • Business Email
  • Shared Mailboxes
  • Calendars
  • Anti-Spam
  • Anti-Malware
  • Email Encryption

Advantages

No email server maintenance

50GB/100GB mailbox storage

High availability

Built-in security

 

2. SharePoint Online (SPO)

SharePoint Online

Purpose

Enterprise Content Management (ECM), Document Management System (DMS), Intranet Portal.

Examples

  • HR Portal
  • Policies Repository
  • Quality Documents
  • Project Sites

Real-Time Scenario

A CRO company stores:

  • SOPs
  • Clinical Trial Documents
  • Regulatory Submissions
  • Training Records

inside SharePoint Online.

Features

  • Document Libraries
  • Metadata
  • Versioning
  • Check In/Check Out
  • Retention Policies
  • Workflows

Advantages

Centralized Repository

Document Collaboration

Search Capability

Compliance Support

Version Control

 

3. OneDrive for Business

OneDrive for Business

Purpose

Personal cloud storage for users.

Example

User stores:

Resume.docx
Project.xlsx
Personal Notes.pdf

Real-Time Scenario

An employee works remotely and saves files to OneDrive.

Files sync automatically across:

  • Laptop
  • Mobile
  • Tablet

Advantages

Personal Storage

Anywhere Access

Automatic Backup

Easy Sharing

 

4. Microsoft Teams

Microsoft Teams

Purpose

Communication and collaboration platform.

Components

  • Chat
  • Meetings
  • Calls
  • Channels
  • File Sharing

Real-Time Scenario

Project Team:

Development Team
QA Team
Infrastructure Team

Uses Teams for:

  • Daily Standups
  • Sprint Planning
  • Document Sharing

Advantages

Reduces Emails

Remote Collaboration

Integrated Meetings

Team Communication

 

5. Microsoft Entra ID (Azure AD)

Microsoft Entra ID

Purpose

Identity and Access Management (IAM).

Examples

Authentication for:

  • SharePoint
  • Teams
  • Exchange
  • OneDrive

Features

  • Single Sign-On (SSO)
  • MFA
  • Conditional Access
  • RBAC

Real-Time Scenario

User logs in once and accesses:

  • Outlook
  • Teams
  • SharePoint

without re-entering credentials.

Advantages

Centralized Authentication

Strong Security

MFA

SSO

 

6. Microsoft Purview

Microsoft Purview

Purpose

Compliance, Governance, Risk Management.

Features

Data Loss Prevention (DLP)

Protects:

  • PAN numbers
  • Aadhaar numbers
  • Credit card data

Retention Policies

Keep documents for:

7 years
10 years
Permanent

Sensitivity Labels

Classify data:

Public
Internal
Confidential
Highly Confidential

Advantages

Compliance

Data Protection

Regulatory Support

Audit Trails

 

7. Microsoft Intune

Microsoft Intune

Purpose

Device and Endpoint Management.

Examples

Manage:

  • Laptops
  • Mobiles
  • Tablets

Real-Time Scenario

Company laptop policy:

  • BitLocker Enabled
  • Antivirus Installed
  • Screen Lock after 10 minutes

Advantages

Device Compliance

Remote Wipe

Mobile Device Management

Security Enforcement

 

8. Power Automate

Power Automate

Purpose

Workflow Automation.

Example Workflow

Document Uploaded

Manager Approval

Email Notification

Document Published

Real-Time Scenario

SOP Approval Process

Author
 
Reviewer
 
QA Approval
 
Published

Advantages

No Coding

Automation

Reduced Manual Work

Faster Processes

 

9. Power Apps

Power Apps

Purpose

Build business applications without heavy coding.

Examples

  • Leave Request App
  • Visitor Management App
  • Asset Tracking App

Advantages

Rapid Development

Mobile Friendly

Easy Integration

Low Cost

 

10. Power BI

Power BI

Purpose

Business Intelligence and Reporting.

Example Dashboard

Shows:

  • Sales
  • Revenue
  • Customer Trends
  • KPIs

Advantages

Real-Time Reporting

Interactive Dashboards

Data Visualization

Decision Making

 

11. Microsoft Forms

Microsoft Forms

Purpose

Create surveys and forms.

Examples

  • Employee Feedback
  • Training Assessment
  • Event Registration

Advantages

Easy Form Creation

Automated Responses

Excel Integration

 

12. Microsoft Planner

Microsoft Planner

Purpose

Task Management.

Example

Project Tasks:

To Do
In Progress
Completed

Advantages

Team Planning

Task Tracking

Progress Monitoring

 

13. Microsoft Viva

Microsoft Viva

Purpose

Employee Experience and Engagement.

Modules

  • Viva Connections
  • Viva Learning
  • Viva Insights

Advantages

Employee Engagement

Learning Management

Productivity Insights

 

M365 Workloads Architecture

                    Microsoft Entra ID
                           |
         -----------------------------------------
         |         |          |         |         |
      Teams   SharePoint   Exchange  OneDrive  Intune
         |         |          |         |         |
         -----------------------------------------
                           |
                    Microsoft Purview
                           |
                    Compliance Layer
                           |
             Power Platform (Apps/Flows/BI)