-
Notifications
You must be signed in to change notification settings - Fork 15
/
03_Create_anti-spam_policies.ps1
39 lines (22 loc) · 1.38 KB
/
03_Create_anti-spam_policies.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Set-Location c:\
Clear-Host
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
#create a spam filter policy
New-HostedContentFilterPolicy -Name "ContosoTom Executives" -HighConfidenceSpamAction Quarantine -SpamAction Quarantine -BulkThreshold 6 #BCL 6 triggers the action for a bulk email spam filtering verdict
#create a spam filter rule
New-HostedContentFilterRule -Name "ContosoTom Executives" -HostedContentFilterPolicy "ContosoTom Executives" -SentToMemberOf "ContosoTom Executives Group"
Get-HostedContentFilterPolicy
Get-HostedContentFilterPolicy -Identity "ContosoTom Executives" | Format-List
Get-HostedContentFilterRule
Get-HostedContentFilterRule -State Disabled
Get-HostedContentFilterRule -State Enabled
Get-HostedContentFilterRule -Identity "ContosoTom Executives" | Format-List
#How do you know these procedures worked?
#Send an with the following string in it:
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
#remove spam filter policies
Remove-HostedContentFilterPolicy -Identity "ContosoTom Executives"
Remove-HostedContentFilterRule -Identity "ContosoTom Executives"
Remove-PSSession $Session