mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 07:53:21 +01:00
commit
c819626612
66
Docs/Windefende.md
Normal file
66
Docs/Windefende.md
Normal file
@ -0,0 +1,66 @@
|
||||
Windefender.ps1
|
||||
================
|
||||
|
||||
This PowerShell script check for windwos defender status and also turn off/on real time monitoring of windows defender.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./Windefender.ps1
|
||||
|
||||
```
|
||||
|
||||
|
||||
<#
|
||||
.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
|
||||
}
|
||||
}
|
69
Docs/install-firefox-browser.md
Normal file
69
Docs/install-firefox-browser.md
Normal file
@ -0,0 +1,69 @@
|
||||
*firefox-installer.ps1*
|
||||
================
|
||||
|
||||
This PowerShell script installs the latest firefox Web browser.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./firefox-installer.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./firefox-installer.ps1
|
||||
|
||||
```
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
|
||||
Related Links
|
||||
-------------
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
Script Content
|
||||
--------------
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
firefox installer
|
||||
.DESCRIPTION
|
||||
Download and install latest firefox
|
||||
.EXAMPLE
|
||||
PS> ./firefox-installer.ps1
|
||||
|
||||
.LINK
|
||||
https://github.com/pakoti/Awesome_Sysadmin
|
||||
.NOTES
|
||||
Author: Dark Master | License: CC0-1,0
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
$Path = $env:TEMP;
|
||||
$Installer = "chrome_installer.exe"
|
||||
Invoke-WebRequest "https://cdn.stubdownloader.services.mozilla.com/builds/firefox-stub/en-US/win/c0c2728dec93a47f981393e20cb0793bafd3a455e152118836bde89b2f02b614/Firefox%20Installer.exe" -OutFile $Path\$Installer
|
||||
Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -Wait
|
||||
Remove-Item $Path\$Installer
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"installed Firefox in $Elapsed sec"
|
||||
exit 0 # successfully installed firefox
|
||||
} catch {
|
||||
"Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,8 @@ Mega Collection of PowerShell Scripts
|
||||
| [enable-crash-dumps.ps1](Scripts/enable-crash-dumps.ps1) | Enables the writing of crash dumps. [Read more...](Docs/enable-crash-dumps.md) |
|
||||
| [hibernate.ps1](Scripts/hibernate.ps1) | Hibernates the local computer immediately. [Read more...](Docs/hibernate.md) |
|
||||
| [install-github-cli.ps1](Scripts/install-github-cli.ps1) | Installs GitHub CLI. [Read more...](Docs/install-github-cli.md) |
|
||||
| [install-chrome-browser.ps1](Scripts/install-chrome-browser.ps1) | Installs the Google Chrome browser. [Read more...](Docs/install-chrome-browser.md) |
|
||||
| [firefox-installer.ps1](Scripts/firefox-installer.ps1) | Installs the firefox browser. [Read more...](Docs/install-firefox-browser.md) |
|
||||
| [install-knot-resolver.ps1](Scripts/install-knot-resolver.ps1) | Installs the Knot Resolver (needs admin rights). [Read more...](Docs/install-knot-resolver.md)|
|
||||
| [install-ssh-client.ps1](Scripts/install-ssh-client.ps1) | Installs a SSH client (needs admin rights). [Read more...](Docs/install-ssh-client.md) |
|
||||
| [install-ssh-server.ps1](Scripts/install-ssh-server.ps1) | Installs a SSH server (needs admin rights). [Read more...](Docs/install-ssh-server.md) |
|
||||
@ -86,6 +88,8 @@ Mega Collection of PowerShell Scripts
|
||||
| [restart-network-adapters.ps1](Scripts/restart-network-adapters.ps1) | Restarts all local network adapters. [Read more...](Docs/restart-network-adapters.md)|
|
||||
| [upgrade-ubuntu.ps1](Scripts/upgrade-ubuntu.ps1) | Upgrades Ubuntu Linux to the latest (LTS) release. [Read more...](Docs/upgrade-ubuntu.md) |
|
||||
| [wake-up.ps1](Scripts/wake-up.ps1) | Wakes up a computer using Wake-on-LAN. [Read more...](Docs/wakeup.md) |
|
||||
|[WinDefender.ps1](Scripts/WinDefender.ps1)|Turn off/on and check for real time monitoring of Windwos Defender. [Read more...](Docs/WinDefender.md)|
|
||||
|
||||
|
||||
💻 Scripts for the Desktop
|
||||
---------------------------
|
||||
|
49
Scripts/Windefender.ps1
Normal file
49
Scripts/Windefender.ps1
Normal file
@ -0,0 +1,49 @@
|
||||
<#
|
||||
.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
|
||||
}
|
||||
}
|
37
Scripts/firefox-installer.ps1
Normal file
37
Scripts/firefox-installer.ps1
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
firefox installer
|
||||
.DESCRIPTION
|
||||
Download and install latest firefox
|
||||
.EXAMPLE
|
||||
PS> ./firefox-installer.ps1
|
||||
|
||||
.LINK
|
||||
https://github.com/pakoti/Awesome_Sysadmin
|
||||
.NOTES
|
||||
Author: Dark Master | License: CC0-1,0
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
$Path = $env:TEMP;
|
||||
$Installer = "chrome_installer.exe"
|
||||
Invoke-WebRequest "https://cdn.stubdownloader.services.mozilla.com/builds/firefox-stub/en-US/win/c0c2728dec93a47f981393e20cb0793bafd3a455e152118836bde89b2f02b614/Firefox%20Installer.exe" -OutFile $Path\$Installer
|
||||
Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -Wait
|
||||
Remove-Item $Path\$Installer
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"installed Firefox in $Elapsed sec"
|
||||
exit 0 # successfully installed firefox
|
||||
} catch {
|
||||
"Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user