PowerShell/scripts/windefender.ps1

50 lines
1.0 KiB
PowerShell
Raw Normal View History

2024-10-01 15:24:16 +02:00
<#
2023-09-29 23:43:39 +02:00
.SYNOPSIS
2023-10-31 13:14:22 +01:00
Configure Windows defender
2023-09-29 23:43:39 +02:00
.DESCRIPTION
2023-10-31 13:14:22 +01:00
This script can enable / disable and show Windows defender real time monitoring!
2023-09-29 23:43:39 +02:00
.EXAMPLE
2023-10-31 13:14:22 +01:00
PS> ./windefender.ps1
2023-09-29 23:43:39 +02:00
.LINK
https://github.com/pakoti/Awesome_Sysadmin
.NOTES
Author: Dark Master | License: CC0-1,0
#>
$defender = Get-MpPreference
$userInput = Read-Host "Enter an option:
[1] Disable real time monitoring
[2] Enable real time monitoring
[3] Check status
"
switch($userInput) {
1 {
$defender.DisableRealtimeMonitoring = $true
$defender | Set-MpPreference
Write-Host "Real-time monitoring of Windows Defender has been disabled."
break
}
2 {
$defender.DisableRealtimeMonitoring = $false
$defender | Set-MpPreference
Write-Host "Real-time monitoring of Windows Defender has been enabled."
break
}
3 {
if($defender.DisableRealtimeMonitoring) {
Write-Host "Real-time monitoring of Windows Defender is currently disabled."
} else {
Write-Host "Real-time monitoring of Windows Defender is currently enabled."
}
break
}
default {
Write-Host "Invalid option selected."
break
}
2023-10-31 13:14:22 +01:00
}