>NULL: powerShell 365

Thursday, 25 July 2019

powerShell 365

Connect to Office 365 PowerShell
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session


Connect to Azure PowerShell
$LiveCred = Get-Credential
Connect-MsolService -Credential $LiveCred

Import-Module Azure


Set the calendar permissions of another user: 
set-MailboxFolderPermission -Identity alias:\calendar -User user@example.com -AccessRights Owner


Set the Default user on every mailbox calendar to Reviewer
$users = Get-Mailbox | Select -ExpandProperty Alias
Foreach ($user in $users)
{
Write-Host $user
set-MailboxFolderPermission $user":\Calendar" -user default -accessrights reviewer
get-MailboxFolderPermission $user":\Calendar" -user default
write-host ""
}

Find where a mailbox alias is in use
Get-Mailbox -Identity * | Where-Object {$_.EmailAddresses -like 'smtp:alias@example.com'} | Format-List Identity

Get details of all folders in all mailboxes
Get-Mailbox | Select-Object alias                                            `
| foreach-object {                                                           `
    Get-MailboxFolderStatistics -Identity $_.alias                           `
    | select-object Identity, ItemsInFolder, FolderSize, FolderAndSubfolderSize }

Remove forwarding on a mailbox
Set-Mailbox bob -ForwardingAddress $Null
Set-Mailbox bob -DeliverToMailboxAndForward $False

Recover all recently deleted items from retention
Restore-RecoverableItems -Identity alias




No comments:

Post a Comment