Saadi_y Posted June 5, 2023 Posted June 5, 2023 (edited) Hi all I am trying to get laptops with compatible processor for windows 11 using script but following part is not working. can anyone advise # Gather the data from the local system$processor = Get-WmiObject -Class Win32_Processor$ProcesorName2 = $processor.Name$ProcessorModel,$Speed = $ProcesorName2 -Split "CPU"# Compare the Processor with modules in arrayif ($ProcessorModel -in $Module){Write-Host "Procesor is compatible"}else {Write-Host $ProcessorModel "is not compatible"} I have attached the scirpt Thanks in advancehardwareinfo4.ps1 Edited June 5, 2023 by Saadi_y
ThomL Posted June 6, 2023 Posted June 6, 2023 (edited) From my testing, issue appears to be whitespace in the $ProcessorModel variable - updating to trim the whitespace got the if working. Updated code, last line removes the whitespace: # Gather the data from the local system $processor = Get-WmiObject -Class Win32_Processor $ProcesorName2 = $processor.Name $ProcessorModel,$Speed = $ProcesorName2 -Split "CPU" $ProcessorModel = $ProcessorModel.TrimEnd(" ") You can also tidy the $Speed variable to remove the "@" and whitespace: # Gather the data from the local system $processor = Get-WmiObject -Class Win32_Processor $ProcesorName2 = $processor.Name $ProcessorModel,$Speed = $ProcesorName2 -Split "CPU" $ProcessorModel = $ProcessorModel.TrimEnd(" ") $Speed = $Speed -replace "@","" $Speed = $Speed.Trim() There's probably a more elegant way to do things, but this was quick and got it working. Edited June 6, 2023 by ThomL 1
mavhc Posted June 6, 2023 Posted June 6, 2023 WUfB will also tell you in more detail which computers are Win11 compatible
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now