See what you’re importing.
Read-only preview
<#
This resource is provided as a convenience for Level users. We cannot
guarantee it will work in all environments. Please test before deploying
to your production environment. We welcome contributions to our community
library.
Level Library
https://level.io/library/script-windows-monitor-device-standards
#>
# ==========================
# Define minimum standards
# ==========================
$minCores = {{cf_minimum_cpu}}
$minRAM = {{cf_minimum_ram}} # in GB
$minDiskSpace = {{cf_minimum_storage}} # in GB
# ==========================
# Standards Bypass Check
# ==========================
$standardsBypass = "{{cf_standards_bypass}}"
$standardsBypass = if ($standardsBypass.ToString().ToLower() -match "^(1|true)$") { $true } else { $false }
if ($standardsBypass) {
Write-Host "Standards check bypassed by configuration"
exit 0
}
# ==========================
# System Checks
# ==========================
# CPU Cores
$cpuCores = (Get-CimInstance Win32_Processor | Measure-Object -Property NumberOfLogicalProcessors -Sum).Sum
# RAM
$totalMemoryBytes = (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory
$totalMemoryGB = [math]::Round($totalMemoryBytes / 1GB, 2)
# Disk Space (local disks only)
$drives = Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DriveType -eq 3 }
$totalDiskSpaceGB = 0
foreach ($drive in $drives) {
$totalDiskSpaceGB += [math]::Round($drive.Size / 1GB, 2)
}
# ==========================
# Evaluate Standards
# ==========================
$issues = @()
# CPU
if ($cpuCores -lt $minCores) {
$issues += "ALERT: CPU has $cpuCores cores, below the minimum requirement of $minCores cores."
}
# RAM
if ($totalMemoryGB -lt $minRAM) {
$issues += "ALERT: System has $totalMemoryGB GB RAM, below the minimum requirement of $minRAM GB."
}
# Disk Space
if ($totalDiskSpaceGB -lt $minDiskSpace) {
$issues += "ALERT: Total disk space is $totalDiskSpaceGB GB, below the minimum requirement of $minDiskSpace GB."
}
# Disk Type
$DiskType = (Get-PhysicalDisk | Where-Object { $_.DeviceID -eq "0" } | Select-Object -ExpandProperty MediaType -ErrorAction SilentlyContinue)
if ($null -eq $DiskType) {
$issues += "WARNING: Unable to determine disk type (no data returned)."
} elseif ($DiskType -notlike "SSD") {
$issues += "ALERT: The primary disk is not an SSD, but is a $DiskType."
}
# ==========================
# Output
# ==========================
if ($issues.Count -gt 0) {
Write-Host ($issues -join "`n")
exit 1
} else {
Write-Host ("System check passed`n" +
"- CPU cores: $cpuCores (min: $minCores)`n" +
"- RAM: $totalMemoryGB GB (min: $minRAM GB)`n" +
"- Disk space: $totalDiskSpaceGB GB (min: $minDiskSpace GB)")
exit 0
}
Before you run it.
Testing
Run this script manually on a test system before deploying to production to validate detection thresholds.
Deployment
Use a script-based monitor in Level to automatically trigger alerts when a device is out of compliance.
Customization
Adjust Minimum CPU, Minimum RAM, and Minimum Storage values in Level’s custom fields to fit your organization’s requirements.
Automation
Combine this script with remediation workflows in Level to trigger upgrade recommendations or automated actions.
Reporting
Regularly review compliance reports to track trends and forecast hardware refresh needs.
More about this resource.
What it does
This script retrieves system hardware details (including CPU core count, total RAM, and disk space) and compares them against the minimum values defined using Level’s custom fields (cf_minimum_cpu, cf_minimum_ram, and cf_minimum_storage). If any component falls below the defined threshold, an alert is generated. Additionally, the script checks if the primary disk is an SSD, warning if a slower HDD is in use. When integrated into Level as a script-based monitor, this ensures that non-compliant devices trigger alerts, enabling IT teams to take action quickly.
When to use it
- Ensure company-issued devices meet minimum hardware standards for performance.
- Detect underperforming endpoints that need upgrades or replacement.
- Enforce hardware compliance policies in MSP and IT environments.
- Reduce help desk tickets caused by outdated or low-spec devices.
- Integrate with Level’s device standards monitoring policy for full cross-platform compliance (Windows, macOS, Linux).
The problem it solves
Inconsistent hardware across an IT environment can lead to performance issues, security risks, and unnecessary support tickets. This script ensures that all Windows devices meet predefined minimum standards for CPU, RAM, and storage, helping IT teams enforce baseline compliance and proactively address underperforming systems before they become a problem.