-
-
Notifications
You must be signed in to change notification settings - Fork 419
/
windefender.ps1
executable file
·49 lines (44 loc) · 1.02 KB
/
windefender.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
40
41
42
43
44
45
46
47
48
49
<#
.SYNOPSIS
Configure Windows defender
.DESCRIPTION
This script can enable / disable and show Windows defender real time monitoring!
.EXAMPLE
PS> ./windefender.ps1
.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
}
}