This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-TransportRule -Name "Encrypt mail marked as Private or Confidential" ` | |
-RuleErrorAction Defer ` | |
-HeaderMatchesMessageHeader "Sensitivity"` | |
-HeaderMatchesPatterns "Private","Company-Confidential" ` | |
-SetAuditSeverity Low ` | |
-ApplyOME $true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-TransportRule -Name "Encrypt mail to Woodgrove Bank" ` | |
-RuleErrorAction Defer ` | |
-RecipientAddressMatchesPatterns '^[A-Z0-9._%+-][email protected]$' | |
-SetAuditSeverity Low ` | |
-ApplyOME $true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-TransportRule -Name "Encrypt mail with [encrypt] in subject" ` | |
-RuleErrorAction Defer ` | |
-SubjectMatchesPatterns '(?:^|\W|\w)\[encrypt\](?:$|\W|\w)' | |
-SetAuditSeverity Low ` | |
-ApplyOME $true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$thumbprintsToSearchFor = @( | |
"aabbccddeeffgg" | |
) | |
$OUs = @( | |
"OU=Servers,DC=contoso,DC=com", | |
"OU=OtherServers,DC=contoso,DC=com" | |
) | |
$logonHistoryDays = 90 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Returns the SSL thumbprint for the certificate of the website | |
.DESCRIPTION | |
The certificate's thumbprint is a hash of the certificate's properties and keys. It is, in theory, a globally unique identifier. | |
.OUTPUTS | |
System.String | |
Get-WebSiteCertificateThumbprint returns a string with the certificate's thumbprint. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-MsolService | |
New-MsolDomain -Name sub.contoso.com -Authentication Federated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-MsolService | |
New-MsolDomain -Name sub.contoso.com -Authentication Managed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Connect to Exchange Online | |
$exo = New-PSSession -ConfigurationName Microsoft.Exchange ` | |
-ConnectionUri https://ps.outlook.com/powershell-liveid ` | |
-Authentication Basic ` | |
-AllowRedirection ` | |
-Credential $(Get-credential) | |
Import-PSSession $exo | |
# Get all mailboxes that do not have litigation hold enabled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-Office365Photo($EmailAddress,$Credential) { | |
$wc = New-Object System.Net.WebClient | |
$wc.credentials = $Credential | |
# Build the URL that'll return the jpeg of the user's photo | |
$url = "https://outlook.office365.com/ews/exchange.asmx/s/GetUserPhoto?email=$EmailAddress&size=HR96x96" | |
# Build a path to export it to (.\[email protected]) | |
$outPath = "$pwd\$EmailAddress.jpg" | |
try { | |
# Download the image and save it to the current directory | |
$wc.DownloadFile($url,$outPath) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fired when a SMSSec 2000 (AuthN failure) occurs | |
$SmtpDetails = @{ | |
"SmtpServer" = "smtp.margiestravel.com" | |
"To" = "[email protected]" | |
"Subject" = "" | |
"Body" = "" | |
"From" = "[email protected]" | |
"BodyAsHtml" = $true | |
"Priority" = "High" |