Archive for the ‘Microsoft 365’ Category.

Microsoft 365 – Powershell Connector Commands

Exhcange:  Connect-ExchangeOnline
Microsoft O365 Admin: Connect-MsolService
AzureAD: Connect-AzureAD
SharePoint Online: Connect-SPOService
SharePoint/OneDrive files and file security: Connect-Pnponline

Exchange Online – Import deleted mailbox into a new mailbox

##Log into Exchange Online
Connect-ExchangeOnline
 
##Must be deleted inbox, view all deleted inboxes with `Get-Mailbox -SoftDeletedMailbox`
$from = "bogus@email.com"
 
##Must be normal exhcange inbox.
$to = "new-bogus@email.com"
 
##Getting Exhcange Object IDs
$fromID = Get-Mailbox -SoftDeletedMailbox -Identity $from  | select ExchangeObjectId
$toID = Get-Mailbox -Identity $to | select ExchangeObjectId
 
##Uncomment to run. be sure you have all the above information correct!
#New-MailboxRestoreRequest -SourceMailbox $fromID -TargetMailbox $toID -TargetRootFolder "Imported"
#New-MailboxRestoreRequest -SourceMailbox $fromID -TargetMailbox $toID 
 
##Verify/Monitor copy progress.
$ident = Get-MailboxRestoreRequest | select Identity
Get-MailboxRestoreRequestStatistics $ident.Identity
 
##good to disconnect
Disconnect-ExchangeOnline

Microsoft 365 – Get password age for all users

Connect-MsolService
Get-MsolUser -All  | select DisplayName, LastPasswordChangeTimeStamp,@{Name=”PasswordAge”;Expression={(Get-Date)-$_.LastPasswordChangeTimeStamp}}

Office 365 – Get distribution group members and output to csv (PowerShell)

#View a list of groups
Get-Group
#Set GroupName before running
Get-DistributionGroupMember -Identity "GroupName"| Export-Csv C:\Users\username\Desktop\groups.csv