Adding Send-As rights
get-user -identity “MAILBOX_NAME” | Add-ADPermission -User “USER_ACCOUNT” -ExtendedRights Send-AsSetting maximum number of active sync devices. Typically this only comes up if you're sharing an account across a fair number of devices.
Get-ThrottlingPolicy Set-ThrottlingPolicy –EASMaxDevices 25 –Identity DefaultThrottlingPolicy_XXXXXXXXXExporting mailboxes directly to PST. You only need to assign Management Role Assignment once per admin account.
New-ManagementRoleAssignment -Role "Mailbox Import Export" -User "ADMIN_ACCOUNT" New-MailboxExportRequest -Mailbox MAILBOX_NAME -FilePath \\ServerName\pst\username.pst Get-MailboxExportRequestFinding emails by email address
get-transportserver | Get-MessageTrackingLog -Start "1/01/2017 12:00:00 am" -End "2/21/2017 17:30:00 pm" -resultsize unlimited |where-object {$_.Recipients -like "user@example.com" -AND $_.EventId -eq "receive"} Get-MessageTrackingLog -Sender "user@example.com" -Recipients "user@example.com" -Start "1/19/2015 8:00AM" | FL Sender,Recipients,MessageSubject,MessageIdSetting up email forwarding
Set-MailboxAutoReplyConfiguration -identity USER_NAME -AutoReplyState enabled -ExternalAudience all -InternalMessage "Internal out of office message." -ExternalMessage "External out of office message." Set-Mailbox USER_NAME -ForwardingAddress USER_NAME -DeliverToMailboxAndForward $TrueGetting list of all the mailboxes and find the mailbox size
$Mailboxes = Get-Mailbox -ResultSize 200 foreach ($Mailbox in $Mailboxes) { $Mailbox | Add-Member -MemberType "NoteProperty" -Name "MailboxSizeMB" -Value ((Get-MailboxStatistics $Mailbox).TotalItemSize.Value.ToMb()) } $Mailboxes | Sort-Object MailboxSizeMB -Desc | Select DisplayName, Alias, PrimarySMTPAddress, MailboxSizeMB | Export-Csv -NoType "C:\Temp\Mailboxes.csv"Updating O365 time zone and language in bulk
$credential = Get-CredentialChanging user name. Usually needed if AD Sync is being wonky, which is fairly common.
$UserCredential = Get-Credential Connect-MsolService -Credential $UserCredential Set-MsolUserPrincipalName -UserPrincipalName olduser24912@example.com -NewUserPrincipalName olduser@example.comCopying membership from a hybrid group to a cloud only group.
$credential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell-liveid?DelegatedOrg=TenantDomainNameHere.onmicrosoft.com -Credential $credential -Authentication Basic -AllowRedirection Import-PSSession $Session $OldMembers = (Get-DistributionGroupMember "ExampleGrpHere").Name New-DistributionGroup Cloud-ExampleGrpHere -Type Distribution -Members $OldMembersRunning updates on a new PC
Powershell.exe -ExecutionPolicy Unrestricted Install-Module PSWindowsUpdate Get-WindowsUpdate Install-WindowsUpdate Restart-ComputerReassociate PC to domain without reboot
Test-ComputerSecureChannel -credential DOMAIN\AdminAccount -Repair