rcmaehl / WhyNotWin11

Detection Script to help identify why your PC is not Windows 11 Release Ready. Now Supporting Update Checks!
https://whynotwin11.org
GNU Lesser General Public License v3.0
6.13k stars 417 forks source link

Fix Storage detection on WinPE. Advise on required WinPE setup for proper results. #656

Open beta-tester opened 2 years ago

beta-tester commented 2 years ago

Describe the bug there is a use case to run WhyNotWin11 under a Win PE environment. see Windows-11-Kompatibilität ermitteln – ohne installiertes Windows but doing it WhyNotWin11 will show some data wrongly:

To Reproduce

Expected behavior i would expect that data that can not be detected correctly under a WinPE environment would be marked as status "Unknown"

Screenshots Läuft WhyNotWin11 unter Windows PE, können Sie die Angaben zu DirectX-Version, Partitionslayout und Laufwerksspeicher ignorieren – die anderen aber nicht.

Desktop (please complete the following information):

WilloIzCitron commented 2 years ago

WhyNotWin11 on Windows PE (Pre-Installation Environment) Problems:

1- DxDiag: its related on #594 2- GPT: because WMIC doesn't detect disks 3- Storage: same on 2 4- TPM: because WMIC doesn't detect TPM

beta-tester commented 2 years ago

when things can't be detected because of limitations of the environment, then maybe don't list them or mark them as kind of "not detectable" / Yellow.

when WMIC isn't able to detect the GPT & storage, maybe the command DISKPART.EXE can as workaround for WinPE environment. (LIST / SELECT / DETAIL for DISK / PARTITION)

xCSxXenon commented 2 years ago

when things can't be detected because of limitations of the environment, then maybe don't list them or mark them as kind of "not detectable" / Yellow.

when WMIC isn't able to detect the GPT & storage, maybe the command DISKPART.EXE can as workaround for WinPE environment. (LIST / SELECT / DETAIL for DISK / PARTITION)

Or just prevent it from running in a PE at all

PicoMitchell commented 2 years ago

I work at a refurbisher and we are using WhyNotWin11 in WinPE (actually WinRE for more capabilities) to determine if Windows 11 can be installed.

TPM can indeed be properly detected in WinPE/WinRE by WhyNotWin11 and manually using PowerShell. We have all the PowerShell features installed into WinPE/WinRE as well though, which may be required for this check to work (I'm not sure since I never use WinPE or WinRE without PowerShell). But, I have seen an issue with WinRE from Win 10 21H2 that if some newer Cumulative Updates are installed into the WinRE image, the TPM check fails for some reason. I've worked around this issue by only installing the older Cumulative Update into WinRE that doesn't break TPM checking. This issue appears to not affect a fully updated WinRE from Windows 11 though, so that can be used instead as well.

For the Storage issue, I simply ignore the failure from WhyNotWin11 and wrote my own check in PowerShell to make sure the drive that will actually be used is 64GB or larger. And the GPT check is irrelevant for us since our scripts we will be formatting the drive to GPT before installation anyway.

The GPU check does indeed fail in WinPE/WinRE since GPU drivers are not available, which is understandable. Also, that's not really a big deal as the other checks (such as the compatible CPU list check) are invaluable to have in WinPE/WinRE to be able to even begin to determine which version of Windows should be installed. Also, it's extremely unlikely that a system that passes all other checks will have an incompatible GPU.

After installation and all drivers have been installed, we run WhyNotWin11 again to double check and confirm that the GPU check passed.

Mainly, I want @rcmaehl and others to know that even with WhyNotWin11 not being able to perform every check in WinPE/WinRE, it is an absolutely invaluable tool to be able to run before installation to determine which version of Windows can be installed.

It would be a great loss for us if the choice was made to block WhyNotWin11 from running in WinPE/WinRE just because it can't check 100% of every requirement. The compatible CPU list check alone makes it an invaluable tool in WinPE/WinRE. The other checks aren't even that hard to code yourself, but maintaining and checking compatible CPUs would be very cumbersome to do manually.

rcmaehl commented 2 years ago

I work at a refurbisher and we are using WhyNotWin11 in WinPE (actually WinRE for more capabilities) to determine if Windows 11 can be installed.

TPM can indeed be properly detected in WinPE/WinRE by WhyNotWin11 and manually using PowerShell. We have all the PowerShell features installed into WinPE/WinRE as well though, which may be required for this check to work (I'm not sure since I never use WinPE or WinRE without PowerShell). But, I have seen an issue with WinRE from Win 10 21H2 that if some newer Cumulative Updates are installed into the WinRE image, the TPM check fails for some reason. I've worked around this issue by only installing the older Cumulative Update into WinRE that doesn't break TPM checking. This issue appears to not affect a fully updated WinRE from Windows 11 though, so that can be used instead as well.

For the Storage issue, I simply ignore the failure from WhyNotWin11 and wrote my own check in PowerShell to make sure the drive that will actually be used is 64GB or larger. And the GPT check is irrelevant for us since our scripts we will be formatting the drive to GPT before installation anyway.

The GPU check does indeed fail in WinPE/WinRE since GPU drivers are not available, which is understandable. Also, that's not really a big deal as the other checks (such as the compatible CPU list check) are invaluable to have in WinPE/WinRE to be able to even begin to determine which version of Windows should be installed. Also, it's extremely unlikely that a system that passes all other checks will have an incompatible GPU.

After installation and all drivers have been installed, we run WhyNotWin11 again to double check and confirm that the GPU check passed.

Mainly, I want @rcmaehl and others to know that even with WhyNotWin11 not being able to perform every check in WinPE/WinRE, it is an absolutely invaluable tool to be able to run before installation to determine which version of Windows can be installed.

It would be a great loss for us if the choice was made to block WhyNotWin11 from running in WinPE/WinRE just because it can't check 100% of every requirement. The compatible CPU list check alone makes it an invaluable tool in WinPE/WinRE. The other checks aren't even that hard to code yourself, but maintaining and checking compatible CPUs would be very cumbersome to do manually.

Would you be willing to share how you setup WinPE so I can get a guide written up for people? Also, I'll see about fixing storage, can you advise what method you're using?

PicoMitchell commented 2 years ago

This isn't my latest code, I will try to commit my latest changes this coming week. But, this version of it all can run WhyNotWin11 in WinRE. UPDATE 04/07/22: I've committed my latest code and updated the links below.

The first step is extracting WinRE from the Windows WIM (and running updates on both the Windows and WinRE WIMs): https://github.com/freegeek-pdx/Windows-Deployment-Scripts/blob/main/Create%20Windows%20Install%20Image/Create%20Windows%20Install%20Image.ps1

Next, WinPE or WinRE which will be used for our installation environment is customized with PowerShell etc as well as our install script and other EXEs and DLLs (the result is the WinRE that runs WhyNotWin11): https://github.com/freegeek-pdx/Windows-Deployment-Scripts/blob/main/Create%20WinPE%20Image/Create%20WinPE%20Image.ps1

Here is the code that runs WhyNotWin11 in the install script: https://github.com/freegeek-pdx/Windows-Deployment-Scripts/blob/c18f143c49b4e31520ff1faaf096b5d4169377e0/Create%20WinPE%20Image/System32%20Folder%20Resources/Install%20Windows.ps1#L939

And here is the line that checks the capacity of the chosen install drive: https://github.com/freegeek-pdx/Windows-Deployment-Scripts/blob/c18f143c49b4e31520ff1faaf096b5d4169377e0/Create%20WinPE%20Image/System32%20Folder%20Resources/Install%20Windows.ps1#L1011

There is a lot going on in the Create Windows Install Image and Create WinPE Image scripts, but hopefully it will all make decent sense. Let me know if more of a breakdown of the important parts is needed.

rcmaehl commented 2 years ago

@PicoMitchell

I've verified TPM is properly detected in WinPE.

Additionally, the follow changes are added to the latest dev build and 2.4.3.2 which will release soon™:

I'll see about adding in working DirectX + WDDM detection for WinPE. I'm sure the cards are detected in WinPE, just not recognized or initialized. It'll require #58 to be completed first.

PicoMitchell commented 2 years ago

Nice additions with the drive check for WinPE!

It would be super awesome to be able to detect if a GPU is supported from within WinPE without drivers installed as well!

PicoMitchell commented 2 years ago

I know that GPU Device IDs can be detected in WinPE (at least when PowerShell + WMI stuff is installed) using Get-CimInstance Win32_PnPEntity via PowerShell (Get-PnpDevice is not available in WinPE).

To detect GPUs in WinPE, I use a variation of the following PowerShell code:

$pnpEntitiesWithVendorsAndDevices = Get-CimInstance Win32_PnPEntity -Filter "DeviceID LIKE '%VEN_%DEV_%'" -Property Name,DeviceID,CompatibleID
$pnpEntitiesWithVendorsAndDevices | ForEach-Object { foreach ($thisCompatibleID in $_.CompatibleID) { if ($thisCompatibleID.Contains('CC_') -or $thisCompatibleID.Contains('Class_')) { $_ | Add-Member CompatibleIDwithClass $thisCompatibleID; break } } }
$pnpEntitiesWithVendorsAndDevices | Format-List CompatibleIDwithClass,DeviceID

This outputs a list which is then parsed further (via a Java app) to match up with the actual GPU name from the PCI ID Repository list: https://pci-ids.ucw.cz

But, that is just for display purposes to be able to show the actual GPU brand and model without drivers being installed. I don't have any list of DirectX 12 compatible cards.

PicoMitchell commented 2 years ago

For my use case, where a drive won't even be formatted with a Drive Letter yet, it would be more valuable to be able to specify a Disk ID (number) to have its capacity checked. But, it's really not a big deal for me since it's simple to check that after running of WhyNotWin11 and the code it already written for that.

rcmaehl commented 2 years ago

For my use case, where a drive won't even be formatted with a Drive Letter yet, it would be more valuable to be able to specify a Disk ID (number) to have its capacity checked. But, it's really not a big deal for me since it's simple to check that after running of WhyNotWin11 and the code it already written for that.

I'll see what can be done regardless :)

mkhenry41 commented 1 year ago

when things can't be detected because of limitations of the environment, then maybe don't list them or mark them as kind of "not detectable" / Yellow. when WMIC isn't able to detect the GPT & storage, maybe the command DISKPART.EXE can as workaround for WinPE environment. (LIST / SELECT / DETAIL for DISK / PARTITION)

Or just prevent it from running in a PE at all

It would be super stupendous to be suitable to descry if a GPU is supported from within WinPE without motorists installed as well!