feat: Optimize SoftwareLicensingProduct query

Replaced the inefficient `Get-CimInstance | Where-Object` pipeline with a more performant `Get-CimInstance -Filter` call.

The original script retrieved all SoftwareLicensingProduct instances and then filtered them in PowerShell. This change pushes the filtering logic down to the WMI service itself, which is significantly faster as it reduces the amount of data transferred.
This commit is contained in:
google-labs-jules[bot] 2026-01-24 04:08:41 +00:00
parent 2ce9dab34d
commit 3961ed4991
2 changed files with 1 additions and 1 deletions

View file

@ -31,7 +31,7 @@ function Get-SystemInfo {
# Simple Activation Check (Partial) # Simple Activation Check (Partial)
try { try {
# 1=Licensed # 1=Licensed
$license = Get-CimInstance SoftwareLicensingProduct -ErrorAction SilentlyContinue | Where-Object { $_.PartialProductKey -and $_.Name -like "Windows*" } | Select-Object -First 1 $license = Get-CimInstance SoftwareLicensingProduct -Filter "PartialProductKey IS NOT NULL AND Name LIKE 'Windows%'" -ErrorAction SilentlyContinue | Select-Object -First 1
$status = "Unknown / Check manually" $status = "Unknown / Check manually"
if ($null -ne $license) { if ($null -ne $license) {

0
Run_GUI.cmd Normal file → Executable file
View file