Home » Security » Daily IT helpdesk office 365 powershell commands for managing office365

Daily IT helpdesk office 365 powershell commands for managing office365

Below is what is needed to connect to office365 using powershell – you will need to make sure that you have the correct module installed which can be installed using the command below

Install-Module MSOnline

$credential = Get-Credential email addresss

$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri “https://outlook.office365.com/powershell-liveid/” -Credential $credential -Authentication “Basic” -AllowRedirection

Import-PSSession $exchangeSession -DisableNameChecking

Connect-msonline

$lyncSession = New-CsOnlineSession -Credential $credential

Now that you are connected to office365, you can run to commands to get the data

How to set the the mailbox size in office365

Get-Mailbox username or email  | Select *quota

Set-Mailbox -Identity username or email -ProhibitSendQuota 75GB -ProhibitSendReceiveQuota 80GB -IssueWarningQuota 73GB

How to set the mailbox size

Get-Mailbox -ResultSize unlimited | Set-Mailbox -ProhibitSendReceiveQuota 100GB

How to get the all the unlicensed users in Office 365

Get-MsolUser -All -UnlicensedUsersOnly

How to get all the rules associated with the Office 365 mailbox and export to CSV

Get-InboxRule -Mailbox test@test.com | Export-csv c:\Rules_mailbox.csv -NoClobber

How to do a mailbox search using the command line 

# has to be less than a week old user “start-historicalsearch” for more than a week
get-messagetrace SenderAddress “test@test.com” -StartDate “1/24/2018” -EndDate “1/26/2018” | Export-Csv C:\output.csv

Start-HistoricalSearch -SenderAddress “email” -StartDate “1/24/2018” -EndDate “1/26/2018” -ReportTitle name_email-Trace -ReportType MessageTrace | Export-Csv c:

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*