Skip to content

Instantly share code, notes, and snippets.

View wise-io's full-sized avatar
🏠
Working from home

Aaron Stevenson wise-io

🏠
Working from home
View GitHub Profile
@wise-io
wise-io / UpdateWindows.ps1
Last active August 24, 2023 22:18
Download & Install Windows Updates with PowerShell
# Install all Windows updates
function Install-PSModule {
param(
[Parameter(Position = 0, Mandatory = $true)]
[String[]]$Modules
)
Write-Output "`nChecking for necessary PowerShell modules..."
try {
# Set PowerShell to TLS 1.2 (https://devblogs.microsoft.com/powershell/powershell-gallery-tls-support/)
@wise-io
wise-io / CleanStart.ps1
Last active September 18, 2023 17:47
Cleans up the taskbar and resets the default start menu layout to remove ads.
# Cleans up default start menu and taskbar (some settings require Windows Pro)
function Install-PSModule {
param(
[Parameter(Position = 0, Mandatory = $true)]
[String[]]$Modules
)
Write-Output "`nChecking for necessary PowerShell modules..."
try {
@wise-io
wise-io / UpdateApps.ps1
Created October 5, 2022 19:40
PowerShell script to initiate Microsoft Store application updates.
# Runs an update check for Microsoft Store apps
###Requires -RunSilent
$namespaceName = "root\cimv2\mdm\dmmap"
$className = "MDM_EnterpriseModernAppManagement_AppManagement01"
$wmiObj = Get-WmiObject -Namespace $namespaceName -Class $className
$result = $wmiObj.UpdateScanMethod()
if ($result.ReturnValue -ne 0) { $result }
else { Write-Output 'Microsoft Store update scan started.' }
@wise-io
wise-io / RemoveApps.ps1
Last active December 30, 2023 19:10
PowerShell script to silently remove various Windows Store applications.
# Remove unnecessary packages
$Allowlist = @(
'DellCommandUpdate', # Dell Command Update app
'HPPrinterControl' # HP Smart app
)
$Identifiers = @(
'AcerIncorporated', # Acer Identifier
'AD2F1837', # HP Identifier
@wise-io
wise-io / RemoveSilverlight.ps1
Created July 7, 2022 21:33
Uninstalls Microsoft Silverlight
# Removes Microsoft Silverlight (x32 & x64)
$Paths = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
$App = Get-ChildItem -Path $Paths | Get-ItemProperty | Where-Object { $_.DisplayName -like 'Microsoft Silverlight' } | Select-Object
foreach ($Ver in $App) {
if ($Ver.UninstallString) {
$DisplayName = $Ver.DisplayName
$Uninst = $Ver.PSChildName
Write-Output "Uninstalling $DisplayName..."
cmd /c msiexec.exe /qn /uninstall $Uninst
@wise-io
wise-io / RunInPWSH.ps1
Last active July 12, 2022 16:12
Installs PWSH (PowerShell 7) and restarts script in PWSH
# Check for required PowerShell version (7+)
if (!($PSVersionTable.PSVersion.Major -ge 7)) {
try {
# Install PowerShell 7 if missing
if (!(Test-Path "$env:SystemDrive\Program Files\PowerShell\7")) {
Write-Output 'Installing PowerShell version 7...'
Invoke-Expression "& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"
}
@wise-io
wise-io / ManageLocalAdmins.ps1
Last active August 3, 2022 20:32
Manages members of the local Administrators security group with PowerShell.
param(
[string[]]$Admins = @()
)
$Admins += @(
# Enter your admin users here as follows:
# "$env:computername\AdminUser1",
# 'DOMAIN\AdminUser2',
# 'AzureAD\AdminUser3'
)
@wise-io
wise-io / ManageDefenderExclusions.ps1
Created May 9, 2022 19:32
Manage Windows Defender Exclusions
# Manage Windows Defender Exclusions
param (
[switch]$Audit, # Audit exclusions
[string[]]$ASR, # Exclude files/paths from ASR rules
[string[]]$Ext, # Exclude file extensions (Example: exe, txt, pdf)
[string[]]$IP, # Exclude IP addresses
[string[]]$Path, # Exclude paths
[string[]]$Process, # Exclude processes
[switch]$Remove # Remove exclusions
@wise-io
wise-io / ScanDefender.ps1
Last active June 8, 2022 17:28
Runs a Windows Defender Scan
# Runs a Windows Defender Scan
param(
[ValidateSet('Full', 'Quick', 'Offline', IgnoreCase)]
[string]$Type = 'Quick', # Scan type (defaults to quick scan)
[System.IO.FileInfo]$Path # Optional local path to scan
)
# Format type parameter
$Type = (Get-Culture).TextInfo.ToTitleCase($Type)
@wise-io
wise-io / ManageDefender.ps1
Last active April 6, 2024 16:26
Manage Windows Defender & Firewall Settings with PowerShell and Group Policy
# Manage Windows Defender & Windows Firewall via Local Group Policy
$ComputerPolicyFile = ($env:SystemRoot + '\System32\GroupPolicy\Machine\registry.pol')
$DefenderKey = 'Software\Policies\Microsoft\Windows Defender'
$FirewallKey = 'Software\Policies\Microsoft\WindowsFirewall'
$ExploitGuardKey = 'Software\Policies\Microsoft\Windows Defender\Windows Defender Exploit Guard'
Write-Output "`nChecking for necessary PowerShell modules..."
try {
# Set PowerShell to TLS 1.2 (https://devblogs.microsoft.com/powershell/powershell-gallery-tls-support/)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12