Troy’s Powershell Cheat Sheet

Connect-MsolService

Install-Module -Name ExchangeOnlineManagement

Connect-ExchangeOnline

exit

  1. 2fa report

Get-MsolUser -All | Select-Object @{N=’UserPrincipalName’;E={$_.UserPrincipalName}},

@{N=’MFA Status’;E={if ($_.StrongAuthenticationRequirements.State){$_.StrongAuthenticationRequirements.State} else {“Disabled”}}},

@{N=’MFA Methods’;E={$_.StrongAuthenticationMethods.methodtype}} | Export-Csv -Path c:\MFA_Report.csv -NoTypeInformation

  1. expand archive

Set-OrganizationConfig -AutoExpandingArchive

  1. install exchonline

Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.4

  1. Add alias to AD

Set-Mailbox Ashley.Todd -EmailAddresses @{Add=’Ashley.Todd@ezknockmarketplace.com’}

  1. To enable plus addressing in your organization, run the following command:

Set-OrganizationConfig -AllowPlusAddressInRecipients $true

EXONLINE:

Set-TransportRule -identity “PPE by-pass filtering” -SenderIpRanges add ip here

Set-InboundConnector -identity “PPE Inbound Connector” -SenderIpAddresses add ip here

New-TransportRule -Name “Reject all but Proofpoint” -Priority 1 -FromScope “NotInOrganization” -DeleteMessage $true -ExceptIfSenderIpRanges add ip here


New-ManagementRoleAssignment –Role “Mailbox Import Export” –User TEArchive

New-MailboxImportRequest-FilePath E:\IT\Backup\Todd\PST Files\TE2021-07-19_Export\07.20.2021-0916AM\Exchange\tengel@sparkmanengel.com.pst -Mailbox “TEArchive”

Get-MsolUser -All | Select-Object @{N=’UserPrincipalName’;E={$_.UserPrincipalName}},@{N=’MFA Status’;E={if ($_.StrongAuthenticationRequirements.State){$_.StrongAuthenticationRequirements.State} else {“Disabled”}}},@{N=’MFA Methods’;E={$_.StrongAuthenticationMethods.methodtype}} | Export-Csv -Path c:\MFA_Report.csv -NoTypeInformation


Get-MailboxFolderPermission Victor.Gurevich:\calendar


Get-DistributionGroup “DTteam” | Add-ADPermission -User “katie” -ExtendedRights “Send As” Get-DistributionGroup “refiteam” | Add-ADPermission -User “irodriguez” -ExtendedRights “Send As”

Add-RecipientPermission -Identity refiteam -Trustee irodriguez -AccessRights SendAs -Confirm:$false

Related Articles