Back to Resources

Level Verified

Windows Monitor - Device Standards Script

Created by

Level

Type

Script

Category

General

Platforms
WindowsApple iOSLinux

Problem Overview

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.

Description

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.

Script

1<#
2This resource is provided as a convenience for Level users. We cannot 
3guarantee it will work in all environments. Please test before deploying 
4to your production environment. We welcome contributions to our community 
5library
6
7Level Library
8https://level.io/library/script-windows-monitor-device-standards
9#>
10
11# Define minimum standards
12$minCores = {{cf_minimum_cpu}}
13$minRAM = {{cf_minimum_ram}}  # in GB
14$minDiskSpace = {{cf_minimum_storage}}  # in GB
15$standardsBypass = {{cf_standards_bypass}}
16Write-Host "Current STANDARDS_BYPASS value: $standardsBypass"
17
18# Check for standards bypass
19if ($standardsBypass -eq $true -or $standardsBypass -eq "1") {
20    Write-Host "Standards check bypassed by configuration"
21    exit 0
22}
23
24# Check CPU Cores
25$cpuCores = (Get-CimInstance Win32_Processor | Measure-Object -Property NumberOfLogicalProcessors -Sum).Sum
26
27# Check RAM
28$totalMemoryBytes = (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory
29$totalMemoryGB = [math]::Round($totalMemoryBytes / 1GB, 2)
30
31# Check Disk Space
32$drives = Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DriveType -eq 3 } # 3 is for local disk
33$totalDiskSpaceGB = 0
34foreach ($drive in $drives) {
35    $totalDiskSpaceGB += [math]::Round($drive.Size / 1GB, 2)
36}
37
38# Prepare to collect issues
39$issues = @()
40
41# Check CPU
42if ($cpuCores -lt $minCores) {
43    $issues += "ALERT: CPU has $cpuCores cores, below the minimum requirement of $minCores cores."
44}
45
46# Check RAM
47if ($totalMemoryGB -lt $minRAM) {
48    $issues += "ALERT: System has $totalMemoryGB GB of RAM, below the minimum requirement of $minRAM GB."
49}
50
51# Check Disk Space
52if ($totalDiskSpaceGB -lt $minDiskSpace) {
53    $issues += "ALERT: Total disk space is $totalDiskSpaceGB GB, below the minimum requirement of $minDiskSpace GB."
54}
55
56# Check if the disk is an SSD
57$DiskType = Get-PhysicalDisk | Where-Object { $_.DeviceID -eq "0" } | select -ExpandProperty MediaType
58if ($DiskType -notlike "SSD") {
59    $issues += "ALERT: The primary disk is not an SSD, but is a $DiskType."
60}
61
62# Output results
63if ($issues.Count -gt 0) {
64    Write-Host ($issues -join "`n")
65    exit 1
66} else {
67    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)"
68    exit 0
69}

Use Cases

  • 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).

Recommendations

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

FAQ

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

Included with this Script:

Below is a list of what you can expect to find when importing this Script.

Script details:

The following data and settings will be imported with your script.

Script Name

Windows Monitor - Device Standards

Description

This PowerShell script checks if a Windows system meets minimum hardware requirements defined through Level Custom Fields. It verifies CPU cores, RAM, disk space, and SSD presence against specified thresholds (cf_minimum_cpu, cf_minimum_ram, cf_minimum_storage). The script collects any violations in an array and outputs either a list of alerts for failed checks or a confirmation message with current specifications if all checks pass, exiting with status code 1 or 0 respectively.

Language

PowerShell

Timeout (In Seconds)

100

Run As

Local system

Import into Level

Related resources

Explore more automations, scripts, and policies to further enhance your IT operations.

View all resources