How to Use the Windows Server Check Script (windows-check)
windows-check is the ITCheckAI read-only check script for Windows Server, covering Windows Server 2012 R2 / 2016 / 2019 / 2022 / 2025 (PowerShell 5.1 or later required). It collects system and security baselines (power plan, pending reboot flags, SMBv1/SCHANNEL TLS/Defender/BitLocker status and expiring machine certificates), hardware inventory, disk and storage health (including hardware RAID vendor CLIs and MPIO/Storage Spaces), networking and NIC driver/RSS/error stats, services and installed software, the last 7 days of error and targeted hardware/storage/BSOD events, a performance snapshot, and role-aware read-only diagnostics (IIS, Active Directory Domain Controller, Failover Cluster, Hyper-V), writing a single .zip archive containing a versioned check.json contract (itcheck.windows.check/1) to the output directory (default %TEMP%). A full run typically takes 30 seconds to 2 minutes, including about 15 seconds of performance counter sampling (pass -SkipPerf to skip live counter sampling).
Script Overview
- File, version and checksum:
windows-check-v2.2.0.ps1, version2.2.0, inner collection schemaitcheck.windows.check/1, written for PowerShell 5.1+ with zero external module dependencies. Download it from Windows Server check script download (the response includes anX-Content-SHA256header); scripts for other operating systems are available on the OS check scripts tool page. Verify the file withGet-FileHash -Algorithm SHA256againstcfcdadd97ac8967cd39cf20df592618b188a62cb9d84b0fe63f741a99f9ab0e0. - Read-only and zero external dependencies: invokes only built-in CIM / WMI queries, read-only PowerShell cmdlets, strictly whitelisted registry reads, and native utilities such as
systeminfo,powercfg,ipconfig,w32tm,mpclaim,dcdiag,repadminandnetdom. It never modifies system settings, registry values or service states, and never installs software; the only writes are the temporary working folder and final.ziparchive under the output directory. - Raw values only; thresholds stay on the server: records raw outputs, original host timestamps with real timezone offsets (RFC 3339), privilege state (
is_admin/privilege_mode), per-item exit codes, elapsed milliseconds, source provenance, byte sizes and SHA-256 hashes. No health verdicts or alert thresholds are embedded;collection.status(complete/partial/failed) describes collection completeness only. - Role-aware probing and distinguishable per-item statuses: default per-command timeout is 30 seconds (60 seconds for performance counter sampling). Failing, missing or hung commands never abort the run and are recorded in
check.jsonasok,empty,permission_denied(non-elevated privilege denial),command_missing(exit 127),timeout(exit 124),failed,not_applicable(absent IIS / AD DC / Failover Cluster / Hyper-V / MPIO / Storage Spaces / NIC teaming marked immediately with zero error and zero overhead) orskipped. - Strict credential boundary and collector-side redaction: never reads
HKLM:\SAM,HKLM:\SECURITY, LSA secrets, Windows Credential Manager, Active DirectoryNTDScredential store, Wi-Fi profile keys, BitLocker recovery keys, certificate private keys or IISweb.config/ connection strings.system/certificates-expiring.logexports onlySubject,Issuer,NotAfter, an 8-charThumbprintPrefixand remaining days;system/environment.logmasks sensitive environment variable values to[REDACTED];system/scheduled-tasks.logrecords only task paths, names, states and executable basenames while omitting all arguments ([args omitted]);software/services-*.logandperformance/top10*.logexclude raw command-line arguments; event logs, shares, environment values, role outputs and free-text sections pass through built-in stream redaction rules replacing PEM private keys, embedded URL passwords,Authorization/Cookie/X-API-Keyheaders, Bearer / JWT / cloud and Git tokens, CLI password flags, database connection-string secrets, RAIDSafe IDand 48-digit BitLocker numerical recovery keys with[REDACTED]. - Standalone upload vs. Center transport envelope: the generated
.zipcan be uploaded directly on its own or carried verbatim as arole="main"file inside an ITCheckAI Center offline upload package (itcheck.package/1+itcheck.manifest/1). Legacy v1.0.0 archives (*.check-*.zipwithoutcheck.json) and v2.0.0 / v2.1.0 archives remain fully backward compatible.
What It Collects
The script collects 51 fixed read-only items across eight stable section subdirectories (plus on-demand storage/raid-<tool>-*.log files when hardware RAID CLIs are installed). Every file is written in UTF-8 without BOM, and check.json records each item's unique id, stable forward-slash relative path, source, requires_admin, started_at_raw / finished_at_raw, duration_ms, exit_code, status, redacted, truncated, size_bytes and sha256:
| Category | Content | Stable paths and main commands / sources |
|---|---|---|
System (system) | System summary, comprehensive computer properties, OS details, uptime, KB hotfixes, time zone and NTP sync, pagefile usage, environment variables (masked), non-disabled scheduled tasks (metadata and executable basename only), active power plan, pending reboot registry flags, security & protocol baseline (SMBv1, SCHANNEL TLS 1.0–1.3, Defender, BitLocker protection status only), and expiring LocalMachine\My certificate metadata (Subject, Issuer, NotAfter, 8-char thumbprint prefix, days remaining) | systeminfo.log, computerinfo.log, os.log, uptime.log, hotfix.log, timezone.log, pagefile.log, environment.log, scheduled-tasks.log, power-plan.log (powercfg /getactivescheme), pending-reboot.log (CBS / WindowsUpdate / PendingFileRenameOperations count), security-baseline.log (Get-SmbServerConfiguration / SCHANNEL / Get-MpComputerStatus / Get-BitLockerVolume status only), certificates-expiring.log (Cert:\LocalMachine\My) |
Hardware (hardware) | Manufacturer and model, BIOS version and serial, CPU topology and clock speed, physical DIMM inventory (vendor, part number, serial, capacity, speed, slot), baseboard details, Plug and Play error devices | computersystem.log (Win32_ComputerSystem), bios.log (Win32_BIOS), cpu.log (Win32_Processor), memory.log (Win32_PhysicalMemory), baseboard.log (Win32_BaseBoard), pnp-problem.log (Win32_PnPEntity non-zero error codes; empty if clean) |
Storage (storage) | Physical disk health, OS disk partition layout, volume capacity and free space, disk temperature / uncorrected error / wear counters, local SMB shares, hardware RAID controller and management tool detection (StorCLI / PercCLI / MegaCLI / ARCCONF / SSACLI / SAS3IRCU / SAS2IRCU / smartctl) with automatic vendor-CLI collection, and MPIO multipath plus Storage Spaces pools and virtual disks | physicaldisk.log (Get-PhysicalDisk), disk.log (Get-Disk), volume.log (Get-Volume), smart.log (Get-StorageReliabilityCounter), shares.log (redacted Get-SmbShare), raid-detect.log, raid-<tool>-*.log (Safe ID redacted), mpio-spaces.log (mpclaim -s -d + non-primordial Get-StoragePool / Get-VirtualDisk; not_applicable when unconfigured) |
Network (network) | Full IP configuration, adapter link status and driver version, IPv4 routes, DNS servers, listening TCP ports with PIDs, Windows Firewall profiles, NIC Teaming (LBFO) state, NIC driver dates/providers, RSS queue configuration, and packet error/discard statistics | ipconfig.log (ipconfig /all), adapters.log (Get-NetAdapter), routes.log (Get-NetRoute -AddressFamily IPv4), dns.log (Get-DnsClientServerAddress), listen.log (Get-NetTCPConnection -State Listen), firewall.log (Get-NetFirewallProfile), teaming.log (Get-NetLbfoTeam), adapter-advanced.log (Get-NetAdapter driver date + Get-NetAdapterRss + Get-NetAdapterStatistics) |
Services and software (software) | Running services (no command-line args), stopped automatic services (with exit codes, no command-line args), 64/32-bit installed software (Uninstall keys only), installed Windows Server roles and features | services-running.log (restricted Win32_Service columns), services-stopped-auto.log (restricted Win32_Service columns), installed.log (HKLM:\...\Uninstall\*), features.log (Get-WindowsFeature; command_missing if module absent) |
Event logs (logs) | Last 7 days of Critical/Error/Warning System events (up to 500), last 7 days of Critical/Error Application events (up to 300), unexpected shutdown and reboot events (IDs 41/6008/1074, up to 50), and last 7 days of targeted hardware/storage/BSOD events (IDs 7/11/51/55/129/153/157/1001/41/6008, up to 200, categorized by bad block, controller reset, NTFS corruption and BugCheck), all with original timezone offsets and stream redaction | system-errors.log, application-errors.log, unexpected-shutdown.log, hardware-storage-events.log (Get-WinEvent; empty if no matching events) |
Performance snapshot (performance) | 5 live samples at 3-second intervals for CPU, available memory and disk queue length, top 10 processes by CPU and memory (restricted columns, no command-line args), physical/virtual memory totals, process/thread/handle counts | counters.log (Get-Counter; skipped with -SkipPerf), top10cpu.log, top10mem.log (restricted Get-Process columns), memory.log (Win32_OperatingSystem), process-count.log (total, non-responding, thread and handle totals) |
Role-aware checks (roles) | On-demand read-only diagnostics for installed server roles: IIS sites/bindings and application pools with .NET runtime (excluding config XML and connection strings), AD Domain Controller health (only when DomainRole is 4 or 5), Failover Cluster nodes/groups/abnormal resources/CSVs, and Hyper-V VM state/uptime, virtual switches and aging snapshots; absent roles are marked not_applicable | iis.log (W3SVC / WebAdministration), ad-health.log (NTDS/DFSR/DNS/Kdc/Netlogon + dcdiag /q + repadmin /replsummary + netdom query fsmo), failover-cluster.log (Get-ClusterNode / Get-ClusterGroup / Get-ClusterResource / Get-ClusterSharedVolume), hyperv.log (Get-VM / Get-VMSwitch / Get-VMSnapshot) |
Note that logs/unexpected-shutdown.log queries Event IDs 41, 6008 and 1074 without the 7-day time limit, returning up to 50 historical entries so earlier unplanned reboots remain visible, whereas logs/hardware-storage-events.log focuses on disk bad blocks, controller resets, NTFS corruption and BugCheck crashes over the last 7 days.
Before You Run It
- Administrator privileges: run inside an elevated (Run as Administrator) PowerShell session (
privilege_mode="administrator", or"system"under NT AUTHORITY\SYSTEM). Standard users can still run the script;collection.is_adminbecomesfalse,privilege_modebecomesnon_admin,warning.txtis written, and restricted items such as storage reliability counters, BitLocker status and IIS/Hyper-V/Cluster management APIs are explicitly markedpermission_deniedrather than mixed withcommand_missingornot_applicable. - PowerShell version and execution policy: PowerShell 5.1 or later is required (check
$PSVersionTable.PSVersion; Windows Server 2012 R2 ships with PowerShell 4.0 and requires WMF 5.1). Passing-ExecutionPolicy Bypassapplies only to the single process and never modifies persistent machine policy. - Output disk space: defaults to
%TEMP%and can be overridden with-OutDirorITCHECK_OUT_DIR. Ensure at least a few hundred megabytes of free space on the target drive. - Per-command timeout protection: every native utility and PowerShell / CIM call runs with an independent timeout (default 30 seconds, or 60 seconds for counter sampling). Hung queries such as stalled WMI calls, oversized event logs or slow
dcdiagruns are classified astimeout(exit code124) so collection proceeds cleanly.
Parameters
The script runs with zero arguments out of the box (preserving compatibility with existing automation and WinRM fan-out) and also supports the following optional parameters and environment variables:
| PowerShell Parameter | Environment Variable | Default | Description |
|---|---|---|---|
-OutDir DIR | ITCHECK_OUT_DIR | %TEMP% | Working and output directory for the final .zip archive |
-CmdTimeoutSec SEC | ITCHECK_CMD_TIMEOUT | 30 | Per-command timeout in seconds for standard collection items (positive integer) |
-PerfTimeoutSec SEC | ITCHECK_PERF_TIMEOUT | 60 | Timeout in seconds for live performance counter sampling (Get-Counter) |
-MaxItemBytes N | ITCHECK_MAX_ITEM_BYTES | 1048576 | Per-item payload cap in bytes (default 1 MiB; sets truncated: true if exceeded) |
-SkipPerf | ITCHECK_SKIP_PERF=1 | off | Skip live Get-Counter sampling (marks item skipped) for fast smoke checks |
-Version / -Help | — | — | Print script version and inner schema, or show usage and exit |
Executable Real-Machine Sampling Steps
- Download the script to an admin workstation, verify its SHA-256 against the tool page, and review its commands before running:
Invoke-WebRequest -Uri "https://<your-itcheckai-site>/tools/os-check/download/windows/" -OutFile .\windows-check-v2.2.0.ps1
(Get-FileHash -Algorithm SHA256 .\windows-check-v2.2.0.ps1).Hash.ToLower()
# Expected digest: cfcdadd97ac8967cd39cf20df592618b188a62cb9d84b0fe63f741a99f9ab0e0
Get-Content .\windows-check-v2.2.0.ps1 | more- Copy the script to the target Windows Server (for example
C:\Temp\; use a bastion host or removable media in air-gapped networks):
$s = New-PSSession -ComputerName 192.168.1.10
Invoke-Command -Session $s -ScriptBlock { New-Item -ItemType Directory -Path C:\Temp -Force | Out-Null }
Copy-Item .\windows-check-v2.2.0.ps1 -Destination C:\Temp\ -ToSession $s- On the target server, open an elevated PowerShell prompt and run the capture (optionally verify with
-SkipPerffirst, then run a full capture):
powershell -ExecutionPolicy Bypass -File C:\Temp\windows-check-v2.2.0.ps1 -Version
# Full capture (30 seconds to 2 minutes, including ~15s live counter sampling):
powershell -ExecutionPolicy Bypass -File C:\Temp\windows-check-v2.2.0.ps1
# Custom output directory without live counter sampling:
powershell -ExecutionPolicy Bypass -File C:\Temp\windows-check-v2.2.0.ps1 -OutDir C:\Temp\out -SkipPerf
# Final line example:
# Check data saved to C:\Users\Administrator\AppData\Local\Temp\HOST01.EXAMPLE01.check-20261202_193000.zip- Retrieve the archive back to your workstation and inspect
check.jsonlocally to verify schema version, privilege mode, status counts and redaction flags:
New-Item -ItemType Directory -Path .\results -Force | Out-Null
$remoteTemp = Invoke-Command -Session $s -ScriptBlock { $env:TEMP }
Copy-Item "$remoteTemp\HOST01.*.check-*.zip" -Destination .\results\ -FromSession $s
# Extract and verify check.json locally
$zip = Get-ChildItem .\results\*.check-*.zip | Sort-Object LastWriteTime -Descending | Select-Object -First 1
Expand-Archive -Path $zip.FullName -DestinationPath .\results\verify -Force
$ins = Get-ChildItem .\results\verify -Recurse -Filter check.json | Select-Object -First 1
Get-Content $ins.FullName -Raw | ConvertFrom-Json | Select-Object schema, collector, collection, host- Once verified on your workstation, remove both the script and archive from the target server and close the remote session:
Invoke-Command -Session $s -ScriptBlock {
Remove-Item -Force C:\Temp\windows-check-v2.2.0.ps1 -ErrorAction SilentlyContinue
Remove-Item -Force "$env:TEMP\HOST01.*.check-*.zip" -ErrorAction SilentlyContinue
}
Remove-PSSession $sOutput
The default archive path is %TEMP%\<hostname>.<serial>.check-<yyyyMMdd_HHmmss>.zip. The hostname comes from $env:COMPUTERNAME; the serial number is queried in order from Get-CimInstance Win32_BIOS (cim_bios), Get-WmiObject Win32_BIOS (wmi_bios) and Win32_ComputerSystemProduct.IdentifyingNumber (cim_csp), stripping whitespace and invalid path characters. If still empty, host.serial is an empty string and the archive filename uses NotAvailable.
Archive directory layout:
HOST01.EXAMPLE01.check-20261202_193000/
├── check.json # itcheck.windows.check/1 contract manifest (timestamps, privilege, statuses, durations, sources, SHA-256)
├── date.log # raw host timestamp with timezone offset (UTF-8 without BOM)
├── warning.txt # created only when not running as Administrator
├── system/ systeminfo.log computerinfo.log os.log uptime.log hotfix.log
│ timezone.log pagefile.log environment.log scheduled-tasks.log
│ power-plan.log pending-reboot.log security-baseline.log
│ certificates-expiring.log
├── hardware/ computersystem.log bios.log cpu.log memory.log baseboard.log
│ pnp-problem.log
├── storage/ physicaldisk.log disk.log volume.log smart.log shares.log raid-detect.log
│ raid-<tool>-*.log (when RAID CLI installed) mpio-spaces.log
├── network/ ipconfig.log adapters.log routes.log dns.log listen.log
│ firewall.log teaming.log adapter-advanced.log
├── software/ services-running.log services-stopped-auto.log installed.log
│ features.log
├── logs/ system-errors.log application-errors.log unexpected-shutdown.log
│ hardware-storage-events.log
├── performance/ counters.log top10cpu.log top10mem.log memory.log process-count.log
└── roles/ iis.log ad-health.log failover-cluster.log hyperv.log- Standalone vs. Center envelope: standalone uploads submit the
.zipdirectly; when packaged by ITCheckAI Center, the outer zip usesitcheck.package/1+itcheck.manifest/1(log.type="itcheck.windows.pm") carrying the exact same.zipbytes asrole="main". - File format and exit code: every section file is written in UTF-8 without BOM, starting with
### <logical command>and appending an explicit footer on non-ok statuses ([command missing: ...],[permission denied: ...],[command timed out after Ns],[not applicable: ...],[skipped: ...]or[command failed with exit code N]). AfterCompress-Archiveproduces a verified non-empty.zip, the script deletes the working folder, outputsCheck data saved to ...zipand exits0. If directory creation orCompress-Archivefails, any partial.zipis removed, collected files andcheck.jsonin$CfgDirare preserved intact for troubleshooting without printing the saved line, and the script exits1.
Reviewing the Results
After extracting the archive, review the key files in the order below:
- Collection completeness: inspect
collection.status,is_admin/privilege_modeandcountsincheck.jsonto separatepermission_denied(non-elevated run),command_missing(absent role/cmdlet module),timeout(stalled WMI or large event log),not_applicable(absent IIS/AD/Cluster/Hyper-V/MPIO/Storage Spaces/NIC teaming) andfailed. - Power plan, pending reboot and security/certificate baselines: check
system/power-plan.log(leaving production servers onBalancedcauses subtle CPU throttling),system/pending-reboot.log(uncompleted patch reboots),system/security-baseline.log(SMBv1 disabled, SCHANNEL TLS 1.0/1.1/1.2 settings, Defender real-time protection and BitLocker protection state), andsystem/certificates-expiring.log(expired or expiring within 30 days). - Stopped automatic services and installed roles: review
software/services-stopped-auto.logandExitCodevalues; inspectroles/iis.log(stopped sites or app pools),roles/ad-health.log(dcdiag /qfailures andrepadmin /replsummaryreplication errors),roles/failover-cluster.log(non-Online resources and redirected CSVs) androles/hyperv.log(snapshots older than 7 or 30 days). - Unexpected reboots and hardware/storage/BSOD events: check
logs/hardware-storage-events.logfirst for disk bad blocks (ID 7), controller resets (ID 129), NTFS corruption (ID 55), I/O retries (ID 153), surprise removals (ID 157) and BugCheck crashes (ID 1001), alongsidelogs/unexpected-shutdown.log(IDs 41/6008/1074),logs/system-errors.logandlogs/application-errors.log. - Hardware, storage, networking and performance headroom: audit
hardware/pnp-problem.log,storage/physicaldisk.log,storage/smart.log,storage/raid-*.logandstorage/mpio-spaces.log; reviewnetwork/adapter-advanced.logfor stale NIC drivers, disabled RSS and rising packet error/discard counts; correlateperformance/counters.logwithtop10cpu.log,top10mem.logandsystem/pagefile.log.
The collector contract is ready for real-machine sampling; automated online report generation will be enabled on the website after multi-version Windows Server field samples are verified. Until then, review the archive using the steps above.
Batch Check
In WinRM-enabled environments, list one hostname or IP per line in hosts.txt and fan out the script with Invoke-Command to collect and retrieve each resulting .zip:
# Fan out execution across listed hosts (archives saved in each host's %TEMP%)
Invoke-Command -ComputerName (Get-Content .\hosts.txt) -FilePath .\windows-check-v2.2.0.ps1
# Run, pull back each exact .zip, and clean up the remote archive
New-Item -ItemType Directory -Path .\results -Force | Out-Null
foreach ($h in (Get-Content .\hosts.txt)) {
if ([string]::IsNullOrWhiteSpace($h)) { continue }
$s = $null
try {
$s = New-PSSession -ComputerName $h.Trim() -ErrorAction Stop
$out = Invoke-Command -Session $s -FilePath .\windows-check-v2.2.0.ps1
$zipLine = $out | Where-Object { $_ -like 'Check data saved to *' } | Select-Object -Last 1
if ($zipLine) {
$remoteZip = ($zipLine -replace '^Check data saved to ', '').Trim()
Copy-Item -Path $remoteZip -Destination .\results\ -FromSession $s
Invoke-Command -Session $s -ScriptBlock { param($p) Remove-Item -LiteralPath $p -Force -ErrorAction SilentlyContinue } -ArgumentList $remoteZip
}
} finally {
if ($s) { Remove-PSSession $s }
}
}Precautions
- Security and compliance: although the collector excludes
SAM/SECURITYhives, LSA secrets, Credential Manager, Wi-Fi keys, BitLocker recovery keys, certificate private keys and IISweb.config/ connection strings, omits service/scheduled-task/process command-line arguments and redacts environment variables and event logs, the archive still contains hostnames, serial numbers, IP addresses, routes, certificate subjects, SMB shares and event logs. Spot-check items markedredacted: trueincheck.jsonbefore sharing outside controlled environments. - Localized performance counter names:
performance/counters.logqueries English counter paths such as\Processor(_Total)\% Processor Time. Modern multilingual Windows Server builds maintain English counter aliases; a damaged counter registry on a stripped installation affects only that single item. - Difference from Microsoft support bundles: this script targets standardized routine health checks with a 1 MiB per-item cap. For kernel crash dumps (BSOD), Failover Clustering quorum failures or official Microsoft support cases, continue collecting diagnostics with Microsoft TSS (TroubleShootingScript Toolset) or WPR.
Note: each execution creates a new timestamped
.zipunder the output directory (default%TEMP%). Remove both the script and archive from the target host once retrieved and verified.