Upload files to "/"

This commit is contained in:
aaron 2023-12-18 18:18:35 +00:00
commit d3d964380f
5 changed files with 149 additions and 0 deletions

View File

@ -0,0 +1,27 @@
$LogonEmail = Read-Host "Enter Logon Email"
Connect-ExchangeOnline -UserPrincipalName $LogonEmail
#Internal Transport rule
$InternalRule = @{
Name = 'DMARC Reject - Internal'
HeaderContainsMessageHeader = 'Authentication-Results'
HeaderContainsWords = 'dmarc=fail action=oreject'
RejectMessageReasonText = 'Unauthenticated email is not accepted due to the domains DMARC policy'
RejectMessageEnhancedStatusCode = '5.7.1'
}
New-TransportRule @InternalRule -Mode Enforce -FromScope InOrganization
#External
$ExternalRule = @{
Name = 'DMARC SCL - External'
HeaderContainsMessageHeader = 'Authentication-Results'
HeaderContainsWords = 'dmarc=fail action=oreject'
SetSCL = 5
}
New-TransportRule @ExternalRule -Mode Enforce -FromScope NotInOrganization
Get-TransportRule
Disconnect-ExchangeOnline -Confirm:$false

34
DKIM.ps1 Normal file
View File

@ -0,0 +1,34 @@
$LogonEmail = Read-Host "Enter Logon Email"
Connect-ExchangeOnline -UserPrincipalName $LogonEmail
$again = $true
while ($again)
{
$Option = Read-Host "
Enter 'g' to see current config,
Enter 'c' to create new config,
Enter 'e' to enable DKIM
Enter 'q' to exit"
if ($Option -eq "g")
{Get-DKIMSigningConfig}
elseif ($Option -eq "c")
{
$Domain = Read-Host "Enter Domain"
New-DKIMSigningConfig -Domain $Domain -Enabled $true
Get-DKIMSigningConfig
}
elseif ($Option -eq "e")
{
$Domain = Read-Host "Enter Domain"
Set-DKIMSigningConfig -Identity $Domain -Enabled $true
Get-DKIMSigningConfig
}
elseif ($Option -eq "q"){$again = $false}
else{Write-Host "Invalid Option, Try again"}
}
Disconnect-ExchangeOnline -Confirm:$false

View File

@ -0,0 +1,9 @@
$LogonEmail = Read-Host "Enter Logon Email"
Connect-ExchangeOnline -UserPrincipalName $LogonEmail
Disable-TransportRule -Identity "*DMARC*"
Get-TransportRule
Disconnect-ExchangeOnline -Confirm:$false

5
Disable-DelayHold.ps1 Normal file
View File

@ -0,0 +1,5 @@
Connect-ExchangeOnline
$Mailboxes = Get-Mailbox
ForEach ($User in $Mailboxes){set-Mailbox $User.UserPrincipalName -RemoveDelayHoldApplied}

74
Get-GroupReport.ps1 Normal file
View File

@ -0,0 +1,74 @@
$LogonEmail = Read-Host "Enter Logon Email"
Connect-ExchangeOnline -UserPrincipalName $LogonEmail
Connect-MgGraph -Scopes "Directory.Read.All"
class Group {
[string]$Name
[string]$DisplayName
[string]$Type
[Member[]]$Members
[string]$UserPrincipalName
[string]$MemberDisplayName
[string]$Mail
}
class Member {
[string]$UserPrincipalName
[string]$MemberDisplayName
[string]$Mail
}
$gs = Get-Group | Select-Object *
$Groups =
ForEach ($g in $gs){
$Group = [Group]::new()
$Group.Name = $g.Name
$Group.DisplayName = $g.DisplayName
$Group.Type = $g.GroupType
$ms = $g.Members
$Members =
ForEach ($m in $ms){
$User = Get-Mailbox -Identity $m | Select-Object *
if ($User.Length -eq 1){
$Member = [Member]::new()
$Member.UserPrincipalName = $User.UserPrincipalName
$Member.MemberDisplayName = $User.DisplayName
$Member.Mail = $User.WindowsEmailAddress
$Member
}
else {
ForEach ($u in $User){
$grs = Get-MgUserMemberOf -UserId $u.UserPrincipalName | Select-Object *
ForEach ($gr in $grs){
if ($gr.AdditionalProperties.displayName -eq $g.DisplayName){
$Member = [Member]::new()
$Member.UserPrincipalName = $u.UserPrincipalName
$Member.MemberDisplayName = $u.DisplayName
$Member.Mail = $u.WindowsEmailAddress
$Member
}
}
}
}
}
$Group.Members = $Members
$Group
}
$Groups2 =
ForEach ($Group in $Groups){
$Group
$Group2 =
ForEach ($member in $Group.Members){$member}
$Group2 = $Group2 | Sort-Object -Property UserPrincipalName -Unique
$Group2
}
$Groups2 | ConvertTo-Csv | Out-File ".\GroupReport.csv"
Disconnect-MgGraph
Disconnect-ExchangeOnline