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
Archive for the ‘Microsoft 365’ Category.
Exhcange: Connect-ExchangeOnline
Microsoft O365 Admin: Connect-MsolService
AzureAD: Connect-AzureAD
SharePoint Online: Connect-SPOService
SharePoint/OneDrive files and file security: Connect-Pnponline
##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
Connect-MsolService
Get-MsolUser -All | select DisplayName, LastPasswordChangeTimeStamp,@{Name=”PasswordAge”;Expression={(Get-Date)-$_.LastPasswordChangeTimeStamp}}
#View a list of groupsGet-Group
#Set GroupName before runningGet-DistributionGroupMember -Identity "GroupName"| Export-Csv C:\Users\username\Desktop\groups.csv