0% found this document useful (0 votes)
30 views4 pages

POwershell

The document provides a comprehensive guide on managing Office 365 licenses and user accounts using PowerShell, covering topics such as connecting to Microsoft Graph, managing licenses, creating and modifying user accounts, and assigning admin roles. It includes specific PowerShell commands for various tasks, including bulk license assignments, creating distribution groups, and managing shared mailboxes. Additionally, it addresses retention policies, mailbox protocols, and email forwarding settings.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views4 pages

POwershell

The document provides a comprehensive guide on managing Office 365 licenses and user accounts using PowerShell, covering topics such as connecting to Microsoft Graph, managing licenses, creating and modifying user accounts, and assigning admin roles. It includes specific PowerShell commands for various tasks, including bulk license assignments, creating distribution groups, and managing shared mailboxes. Additionally, it addresses retention policies, mailbox protocols, and email forwarding settings.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

https://office365concepts.

com/powershell/page/3/

SESSION 1 - https://office365concepts.com/manage-office-365-licenses-with-
powershell/
https://office365concepts.com/how-to-connect-to-microsoft-graph-powershell/
1. PowerShell basics (Transcript and CLIP commands).
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Install-Module Microsoft.Graph -Scope CurrentUser
Install-Module Microsoft.Graph.Beta
Connect-MgGraph -Scopes Directory.Read.All, Directory.ReadWrite.All,
Organization.ReadWrite.All

2. Managing Licenses.
Get-MgSubscribedSku | Select-Object SkuId,SkuPartNumber,ServicePlans,ConsumedUnits
Get-MgSubscribedSku | FL

***Show number of licenses vs. used.


Get-MgSubscribedSku
$licenses | Select-Object SkuPartNumber,
@{Name="TotalLicenses";Expression={$_.PrepaidUnits.Enabled}},
@{Name="UsedLicenses";Expression={$_.ConsumedUnits}},
@{Name="AvailableLicenses";Expression={($_.PrepaidUnits.Enabled -
$_.ConsumedUnits)}}

***Users Without License


Get-MgUser -All -Property DisplayName, AssignedLicenses | Where-Object { -not
$_.AssignedLicenses } | Format-Table DisplayName, AssignedLicenses

***With License
Get-MgUser -All -Property DisplayName, AssignedLicenses | Where-Object
{$_.AssignedLicenses} | Format-Table DisplayName, AssignedLicenses

***Add New User


New-MgUser -UserPrincipalName "bobross@LessandraInc.onmicrosoft.com" `
-DisplayName "Bob Ross" `
-GivenName "Bob" `
-Surname "Ross" `
-UsageLocation "PH" `
-PasswordProfile @{ Password = "che3r$2u@#$%";
ForceChangePasswordNextSignIn = $false } `
-AccountEnabled:$true `

***Show serviceplans running for a user:


(Get-MgUserLicenseDetail -UserId "aris.reyes@lessandrainc.onmicrosoft.com") |
ForEach-Object { $_.ServicePlans }

***modify a user object


Set-MgUser -UserId "aris.reyes@lessandrainc.onmicrosoft.com" -DisplayName "Aris
Reyes" -Department "Service Management"

# Create an object for the updates


$userUpdate = @{
DisplayName = "Aris Reyes"
Department = "Service Management"
}

# Apply the update


Update-MgUser -UserId "aris.reyes@lessandrainc.onmicrosoft.com" -BodyParameter
$userUpdate

3. Assigning licenses to user accounts.


Get-MgSubscribedSku | Select-Object SkuId,SkuPartNumber
Get-MgSubscribedSku -All | Where SkuPartNumber -eq "O365_BUSINESS_ESSENTIALS" |
Select-Object SkuId
Set-MgUserLicense –UserId "bobross@office365concepts.com" -AddLicenses @{SkuId =
"3b555118-da6a-4418-894f-7df1e2096870"} -RemoveLicenses @()

To update Usage Location for an account, run below Graph PowerShell command:
Update-MgUser -UserId "john@office365concepts.com" -UsageLocation IN

Assign multiple licenses to a user using Graph PowerShell


# Define user UPN and license SkuIDs (replace with actual values)
$userUpn = "smith@office365concepts.com"
$licenseSkuId1 = "f30db892-07e9-47e9-837c-80727f46fd3d"
$licenseSkuId2 = "3b555118-da6a-4418-894f-7df1e2096870" # Add more as needed

# Create hash tables for each license


$license1 = @{ SkuId = $licenseSkuId1 }
$license2 = @{ SkuId = $licenseSkuId2 }

# Combine licenses into an array


$licenses = @($license1, $license2) # Add more license hash tables to the array

# Assign licenses and remove any existing ones


Set-MgUserLicense -UserId $userUpn -AddLicenses $licenses -RemoveLicenses @()

Bulk license - https://office365concepts.com/assign-office-365-licenses-with-graph-


powershell/#assign-office-365-licenses-with-graph-power-shell

Assign multiple licenses to multiple users using CSV and Graph PowerShell
Assign same license from one user to another using Graph PowerShell

4. Create user accounts.


https://office365concepts.com/manage-office-365-users-using-graph-powershell/
#manage-user-account-properties-using-power-shell

5. Modify user account attributes.


6. Delete and restore user accounts.
https://office365concepts.com/manage-office-365-users-using-graph-powershell/
#manage-user-account-properties-using-power-shell
7. Purge user accounts.
8. Create user accounts in bulk with CSV file
https://office365concepts.com/manage-office-365-users-using-graph-powershell/
#manage-user-account-properties-using-power-shell
https://office365concepts.com/manage-users-in-office-365-using-powershell/

SESSION 2
1. Managing custom and initial Domains.
2. Setting domains as default domains.
3. Managing Admin roles.
4. Assigning Admin roles to user accounts.
5. Managing Password Policies.
6. Resetting password for user accounts.
7. Set passwords as never expire.
8. Force users to reset password on next login attempt.
9. Manage Directory Synchronisation settings.

SESSION 3 - https://office365concepts.com/manage-distribution-groups-with-
powershell/
1. Create Distribution groups.
2. Create Dynamic Distribution groups. - https://office365concepts.com/manage-
dynamic-distribution-groups-using-powershell/
3. Create Security Groups.
4. Create Office 365 groups.
5. Add and remove members in groups.
6. Modifying groups attributes.
7. Assigning SendAs and Send On Behalf permissions on groups.

SESSION 4
How to create shared mailbox using powershell.
Modify shared mailbox attributes.
Assigning Full Access permission on shared mailbox using powershell.
Assigning Send As permission on shared mailbox using powershell.
Assigning Send On Behalf permission on a shared mailbox using powershell.
Enabling auto-mapping while assigning Full Access permissions.
Enable online Archive for a shared mailbox.

SESSION 5 https://office365concepts.com/manage-room-mailbox-using-powershell/
https://office365concepts.com/manage-room-mailbox-permissions-using-powershell/
What is Room mailbox in office 365
What is Equipment mailbox in Office 365
What are equipment mailboxes.
How to create room mailbox with powershell commands
How to create equipment mailbox using powershell commands
Resource mailboxes calendar.
Important attributes of calendar.
How to Modify calendar attributes.
Allow Conflict
Resource Delegate booking
Allow recurring meetings
What is auto mapping
How to assign full access permission
How to assign send as permission
How to assign send on behalf permission

SESSION 6
Create Retention Tags using Powershell commands
Create Default Policy Tag (DPT), Retention Policy Tag (RPT) and Personal Tag.
Create Retention Policy using PowerShell
Add Retention Tags within the Retention Policy
Apply Retention Policy on mailboxes

SESSION 7
Troubleshoot Retention Policy using Powershell commands
***NOTE- Check retention hold, retention policy will not work, manage folder
assistant will not process the mailbox

get-mailbox -identity "userb" | fl *hold*

Troubleshoot Retention Tags using PowerShell commands


Retention Hold
Litigation Hold
In Place Hold
Managed Folder Assistant
Start-ManagedFolderAssistant
Messaging Records Management
How to collect and analyse logs
ELC Processing

SESSION 8
How to set a profile picture for a user account in Office 365 using powershell
commands.

set-userphoto -identity "userb" -picturedata ([system.io.file]::ReadAllBytes("C:\


users\qfa00803\0365.jpg"))

SESSION 9
What are mailbox protocols
How to check mailbox protocols using powershell commands

How to check protocols for all users in Office 365


MAPI Protocol
OWA Protocol
EWS Protocol
IMAP Protocol
POP Protocol
SMTP Client Authentication Protocol
How to enable and disable Protocols

SESSION 10
What are trusted senders
What is allow list and block list
How to add sender's email address and domains in allow list and block list of junk
settings
How to add multiple senders and domains in junk settings
Junk email settings
Junk email settings in Outlook
Outlook junk folder

SESSION 11 - https://office365concepts.com/manage-office-365-email-forwarding/
How to enable mailbox forwarding
How to verify mailbox forwarding
Forward emails to internal users
Forward emails to external users
How to save emails in the mailbox and then forward

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy