Skip to content

Commit

Permalink
removes fuckup
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Aug 8, 2024
1 parent 749b69c commit 05eeb6e
Show file tree
Hide file tree
Showing 108 changed files with 211 additions and 423 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ function Invoke-CIPPStandardAPConfig {
Internal
#>
param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'APConfig'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'APConfig'

If ($Settings.remediate -eq $true) {

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Invoke-CIPPStandardAPESP {
#>
param($Tenant, $Settings)
If ($Settings.remediate -eq $true) {
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'APESP'
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'APESP'
if ($Rerun -eq $true) {
exit 0
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ function Invoke-CIPPStandardActivityBasedTimeout {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -API 'ActivityBasedTimeout' -Settings $Settings
if ($Rerun -eq $true) {
exit 0
}
#$Rerun -Type Standard -Tenant $Tenant -API 'ActivityBasedTimeout' -Settings $Settings

# Input validation
if ([string]::IsNullOrWhiteSpace($Settings.timeout) -or $Settings.timeout -eq 'Select a value' ) {
Write-LogMessage -API 'Standards' -tenant $tenant -message 'ActivityBasedTimeout: Invalid timeout parameter set' -sev Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ function Invoke-CIPPStandardAddDKIM {

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -API 'AddDKIM' -Settings $Settings
if ($Rerun -eq $true) {
exit 0
}


$AllDomains = (New-GraphGetRequest -uri 'https://graph.microsoft.com/v1.0/domains?$top=999' -tenantid $Tenant | Where-Object { $_.supportedServices -contains 'Email' -or $_.id -like '*mail.onmicrosoft.com' }).id
$DKIM = (New-ExoRequest -tenantid $tenant -cmdlet 'Get-DkimSigningConfig') | Select-Object Domain, Enabled, Status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ function Invoke-CIPPStandardAnonReportDisable {

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -API 'allowOTPTokens' -Settings $Settings
if ($Rerun -eq $true) {
exit 0
}

$CurrentInfo = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/admin/reportSettings' -tenantid $Tenant -AsApp $true

If ($Settings.remediate -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ function Invoke-CIPPStandardAntiPhishPolicy {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'AntiPhishPolicy'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'AntiPhishPolicy'

$PolicyName = 'Default Anti-Phishing Policy'

$CurrentState = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AntiPhishPolicy' |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Invoke-CIPPStandardAppDeploy {
param($Tenant, $Settings)

If ($Settings.remediate -eq $true) {
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'AppDeploy'
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'AppDeploy'
if ($Rerun -eq $true) {
exit 0
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ function Invoke-CIPPStandardAtpPolicyForO365 {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'AtpPolicyForO365'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'AtpPolicyForO365'

$CurrentState = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AtpPolicyForO365' |
Select-Object EnableATPForSPOTeamsODB, EnableSafeDocs, AllowSafeDocsOpen

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ function Invoke-CIPPStandardAuditLog {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'AuditLog'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'AuditLog'

Write-Host ($Settings | ConvertTo-Json)
$AuditLogEnabled = (New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AdminAuditLogConfig' -Select UnifiedAuditLogIngestionEnabled).UnifiedAuditLogIngestionEnabled

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ function Invoke-CIPPStandardAutoExpandArchive {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'AutoExpandArchive'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'AutoExpandArchive'

$CurrentState = (New-ExoRequest -tenantid $Tenant -cmdlet 'Get-OrganizationConfig').AutoExpandingArchiveEnabled

If ($Settings.remediate -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ function Invoke-CIPPStandardBookings {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'Bookings'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'Bookings'

$CurrentState = (New-ExoRequest -tenantid $Tenant -cmdlet 'Get-OrganizationConfig').BookingsEnabled
$WantedState = if ($Settings.state -eq 'true') { $true } else { $false }
$StateIsCorrect = if ($CurrentState -eq $WantedState) { $true } else { $false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ function Invoke-CIPPStandardBranding {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'Branding'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'Branding'

$TenantId = Get-Tenants | Where-Object -Property defaultDomainName -EQ $Tenant

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ function Invoke-CIPPStandardCloudMessageRecall {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'CloudMessageRecall'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'CloudMessageRecall'

$CurrentState = (New-ExoRequest -tenantid $Tenant -cmdlet 'Get-OrganizationConfig').MessageRecallEnabled
$WantedState = if ($Settings.state -eq 'true') { $true } else { $false }
$StateIsCorrect = if ($CurrentState -eq $WantedState) { $true } else { $false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ function Invoke-CIPPStandardConditionalAccess {
Internal
#>
param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'ConditionalAccess'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'ConditionalAccess'

If ($Settings.remediate -eq $true) {

$APINAME = 'Standards'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ function Invoke-CIPPStandardDelegateSentItems {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -API 'DelegateSentItems' -Settings $Settings
if ($Rerun -eq $true) {
exit 0
}
#$Rerun -Type Standard -Tenant $Tenant -API 'DelegateSentItems' -Settings $Settings



$Mailboxes = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-Mailbox' -cmdParams @{ RecipientTypeDetails = @('UserMailbox', 'SharedMailbox') } |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ function Invoke-CIPPStandardDeletedUserRentention {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DeletedUserRetention'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DeletedUserRetention'

$CurrentInfo = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/admin/sharepoint/settings' -tenantid $Tenant -AsApp $true

if ($Settings.report -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ function Invoke-CIPPStandardDisableAddShortcutsToOneDrive {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableAddShortcutsToOneDrive'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableAddShortcutsToOneDrive'

$CurrentState = Get-CIPPSPOTenant -TenantFilter $Tenant | Select-Object _ObjectIdentity_, TenantFilter, DisableAddToOneDrive

if ($Settings.report -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ function Invoke-CIPPStandardDisableAdditionalStorageProviders {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableAdditionalStorageProviders'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableAdditionalStorageProviders'

$AdditionalStorageProvidersState = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-OwaMailboxPolicy' -cmdParams @{Identity = 'OwaMailboxPolicy-Default' }

if ($Settings.remediate -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ function Invoke-CIPPStandardDisableAppCreation {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableAppCreation'
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableAppCreation'


if ($Rerun -eq $true) {
exit 0
}
$CurrentInfo = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/policies/authorizationPolicy/authorizationPolicy?$select=defaultUserRolePermissions' -tenantid $Tenant

If ($Settings.remediate -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ function Invoke-CIPPStandardDisableBasicAuthSMTP {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableBasicAuthSMTP'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableBasicAuthSMTP'

$CurrentInfo = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-TransportConfig'
$SMTPusers = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-CASMailbox' -cmdParams @{ ResultSize = 'Unlimited' } | Where-Object { ($_.SmtpClientAuthenticationDisabled -eq $false) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ function Invoke-CIPPStandardDisableEmail {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableEmail'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableEmail'

$CurrentInfo = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/policies/authenticationmethodspolicy/authenticationMethodConfigurations/Email' -tenantid $Tenant
$State = if ($CurrentInfo.state -eq 'enabled') { $true } else { $false }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ function Invoke-CIPPStandardDisableExternalCalendarSharing {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableExternalCalendarSharing'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableExternalCalendarSharing'

$CurrentInfo = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SharingPolicy' | Where-Object { $_.Default -eq $true }

if ($Settings.remediate -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ function Invoke-CIPPStandardDisableGuestDirectory {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableGuestDirectory'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableGuestDirectory'

$CurrentInfo = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/policies/authorizationPolicy/authorizationPolicy' -tenantid $Tenant

If ($Settings.remediate -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ function Invoke-CIPPStandardDisableGuests {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableGuests'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableGuests'

$Lookup = (Get-Date).AddDays(-90).ToUniversalTime().ToString('o')
$GraphRequest = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users?`$filter=(signInActivity/lastNonInteractiveSignInDateTime le $Lookup)&`$select=id,UserPrincipalName,signInActivity,mail,userType,accountEnabled" -scope 'https://graph.microsoft.com/.default' -tenantid $Tenant | Where-Object { $_.userType -EQ 'Guest' -and $_.AccountEnabled -EQ $true }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ function Invoke-CIPPStandardDisableM365GroupUsers {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableM365GroupUsers'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableM365GroupUsers'

$CurrentState = (New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/settings' -tenantid $tenant) | Where-Object -Property displayname -EQ 'Group.unified'

If ($Settings.remediate -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ function Invoke-CIPPStandardDisableOutlookAddins {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableOutlookAddins'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableOutlookAddins'

$CurrentInfo = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-RoleAssignmentPolicy' | Where-Object { $_.IsDefault -eq $true }
$Roles = @('My Custom Apps', 'My Marketplace Apps', 'My ReadWriteMailbox Apps')
$RolesToRemove = foreach ($Role in $Roles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ function Invoke-CIPPStandardDisableReshare {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableReshare'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableReshare'

$CurrentInfo = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/admin/sharepoint/settings' -tenantid $Tenant -AsApp $true

If ($Settings.remediate -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ function Invoke-CIPPStandardDisableSMS {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableSMS'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableSMS'

$CurrentInfo = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/policies/authenticationmethodspolicy/authenticationMethodConfigurations/SMS' -tenantid $Tenant
$State = if ($CurrentInfo.state -eq 'enabled') { $true } else { $false }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ function Invoke-CIPPStandardDisableSecurityGroupUsers {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableSecurityGroupUsers'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableSecurityGroupUsers'

$CurrentInfo = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/policies/authorizationPolicy/authorizationPolicy' -tenantid $Tenant

If ($Settings.remediate -eq $true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ function Invoke-CIPPStandardDisableSelfServiceLicenses {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableSelfServiceLicenses'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableSelfServiceLicenses'

#Write-LogMessage -API 'Standards' -tenant $tenant -message 'Self Service Licenses cannot be disabled' -sev Error
try {
$selfServiceItems = (New-GraphGETRequest -scope 'aeb86249-8ea3-49e2-900b-54cc8e308f85/.default' -uri 'https://licensing.m365.microsoft.com/v1.0/policies/AllowSelfServicePurchase/products' -tenantid $Tenant).items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ function Invoke-CIPPStandardDisableSharePointLegacyAuth {
#>

param($Tenant, $Settings)
$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings -API 'DisableSharePointLegacyAuth'
if ($Rerun -eq $true) {
exit 0
}
#$Rerun = Test-CIPPRerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableSharePointLegacyAuth'

$CurrentInfo = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/admin/sharepoint/settings?$select=isLegacyAuthProtocolsEnabled' -tenantid $Tenant -AsApp $true

If ($Settings.remediate -eq $true) {
Expand Down
Loading

0 comments on commit 05eeb6e

Please sign in to comment.