ScriptGeneralWindows

Check Windows hardware standards

Compare Windows CPU, memory, storage, and disk type against your configured requirements.

See what you’re importing.

Read-only preview

PowerShell Timeout 100s Runs as Local system
<#
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.

  1. Testing

    Run this script manually on a test system before deploying to production to validate detection thresholds.

  2. Deployment

    Use a script-based monitor in Level to automatically trigger alerts when a device is out of compliance.

  3. Customization

    Adjust Minimum CPU, Minimum RAM, and Minimum Storage values in Level’s custom fields to fit your organization’s requirements.

  4. Automation

    Combine this script with remediation workflows in Level to trigger upgrade recommendations or automated actions.

  5. 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.

Frequently asked questions.

How do I configure this script in Level?

Create a script-based monitor within Level and set it to trigger this script. Alerts will be generated when a device fails compliance checks.

What happens if a device is below the required specs?

The script outputs a list of non-compliant components and exits with a failure code (exit 1), allowing Level to detect and alert accordingly.

Can I modify the minimum requirements dynamically?

Yes, the script pulls values from Level’s custom fields, which you can adjust in your Level settings without modifying the script itself. This allows you to override the values at the group and device levels.

Does this script consider multiple storage drives?

Yes, it calculates the total disk space across all local drives and ensures the primary disk is an SSD.

Can I use this script for macOS or Linux?

No, this version is specific to Windows. However, consider using Level’s device standards monitoring policy, which includes equivalent checks for macOS and Linux.

Ready when you are.

No credit card. No sales call. Just sign up and start managing.