mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-24 17:03:45 +01:00
86 lines
1.7 KiB
Markdown
86 lines
1.7 KiB
Markdown
|
*Windefender.ps1*
|
||
|
================
|
||
|
|
||
|
This script can enable disable and show windows defender real time monitoring!
|
||
|
|
||
|
Parameters
|
||
|
----------
|
||
|
```powershell
|
||
|
PS> ./Windefender.ps1 [<CommonParameters>]
|
||
|
|
||
|
[<CommonParameters>]
|
||
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||
|
```
|
||
|
|
||
|
Example
|
||
|
-------
|
||
|
```powershell
|
||
|
PS> ./Windefender.ps1
|
||
|
|
||
|
```
|
||
|
|
||
|
Notes
|
||
|
-----
|
||
|
Author: Dark Master | License: CC0-1,0
|
||
|
|
||
|
Related Links
|
||
|
-------------
|
||
|
https://github.com/pakoti/Awesome_Sysadmin
|
||
|
|
||
|
Script Content
|
||
|
--------------
|
||
|
```powershell
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Windows defender in powershell
|
||
|
.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
|
||
|
}
|
||
|
}
|
||
|
```
|
||
|
|
||
|
*(generated by convert-ps2md.ps1 using the comment-based help of Windefender.ps1 as of 10/19/2023 08:11:43)*
|