This PowerShell script provides a quick and colorful overview of key Windows 11 security features, including Microsoft Defender, Firewall, Secure Boot, BitLocker, VBS, Credential Guard, and TPM status. It uses error handling to ensure reliability and presents results in an easy-to-read format, highlighting whether each feature is enabled or disabled.
Click to view script…
# Quick Windows 11 Security Features Check
# Check if the script is running with administrator privileges
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Warning "This script should be run as Administrator for full functionality."
}
# Microsoft Defender Status
Write-Host "`nMicrosoft Defender Status:" -ForegroundColor Cyan
$defenderStatus = Get-MpComputerStatus
Write-Host "Antivirus Enabled: " -NoNewline
if ($defenderStatus.AntivirusEnabled) { Write-Host "Yes" -ForegroundColor Green } else { Write-Host "No" -ForegroundColor Red }
Write-Host "Real-Time Protection: " -NoNewline
if ($defenderStatus.RealTimeProtectionEnabled) { Write-Host "Yes" -ForegroundColor Green } else { Write-Host "No" -ForegroundColor Red }
Write-Host "Tamper Protected: " -NoNewline
if ($defenderStatus.IsTamperProtected) { Write-Host "Yes" -ForegroundColor Green } else { Write-Host "No" -ForegroundColor Red }
# Firewall Status
Write-Host "`nFirewall Status:" -ForegroundColor Cyan
$firewallStatus = Get-NetFirewallProfile
foreach ($profile in $firewallStatus) {
Write-Host "$($profile.Name) Profile: " -NoNewline
if ($profile.Enabled) { Write-Host "Enabled" -ForegroundColor Green } else { Write-Host "Disabled" -ForegroundColor Red }
}
# Secure Boot Status
Write-Host "`nSecure Boot:" -ForegroundColor Cyan
try {
$secureBoot = Confirm-SecureBootUEFI
Write-Host "Status: " -NoNewline
if ($secureBoot) { Write-Host "Enabled" -ForegroundColor Green } else { Write-Host "Disabled" -ForegroundColor Red }
} catch {
Write-Host "Status: Not supported or error occurred" -ForegroundColor Yellow
}
# BitLocker Status
Write-Host "`nBitLocker Status:" -ForegroundColor Cyan
$bitLockerStatus = Get-BitLockerVolume
foreach ($volume in $bitLockerStatus) {
Write-Host "$($volume.MountPoint) Protection: " -NoNewline
if ($volume.ProtectionStatus -eq "On") { Write-Host "On" -ForegroundColor Green } else { Write-Host "Off" -ForegroundColor Red }
}
# VBS and Credential Guard
Write-Host "`nVBS and Credential Guard:" -ForegroundColor Cyan
try {
$deviceGuard = Get-CimInstance -ClassName Win32_DeviceGuard -ErrorAction Stop
$vbsStatus = if ($deviceGuard.VirtualizationBasedSecurityStatus -eq 2) { "Enabled" } else { "Disabled" }
$credGuard = if ($deviceGuard.SecurityServicesRunning -contains 1) { "Enabled" } else { "Disabled" }
Write-Host "VBS: " -NoNewline
if ($vbsStatus -eq "Enabled") { Write-Host "Enabled" -ForegroundColor Green } else { Write-Host "Disabled" -ForegroundColor Red }
Write-Host "Credential Guard: " -NoNewline
if ($credGuard -eq "Enabled") { Write-Host "Enabled" -ForegroundColor Green } else { Write-Host "Disabled" -ForegroundColor Red }
} catch {
Write-Host "VBS and Credential Guard status not available on this system." -ForegroundColor Yellow
}
# TPM Status
Write-Host "`nTPM Status:" -ForegroundColor Cyan
$tpmStatus = Get-Tpm
Write-Host "TPM Present: " -NoNewline
if ($tpmStatus.TpmPresent) { Write-Host "Yes" -ForegroundColor Green } else { Write-Host "No" -ForegroundColor Red }
Write-Host "TPM Ready: " -NoNewline
if ($tpmStatus.TpmReady) { Write-Host "Yes" -ForegroundColor Green } else { Write-Host "No" -ForegroundColor Red }
Write-Host "`nSecurity Features Check Complete" -ForegroundColor Cyan