0

I have a WinPE iso copied to an USB stick. In the WinPE environment the user enters a physical disk number. I want to create a warning if this physical disk looks like the WinPE disk.

My solution is to check whether the folders on it corresponds to the WinPE disk content. To do this I need the drive letter in order to Test-Path.

It looks like this solution Combine Get-Disk info and LogicalDisk info in PowerShell?.

But it does not work in WinPE environment: Some WMI doesn't work in Windows PE.

How can I check the content of the selected physical disk?

henrycarteruk
  • 12,708
  • 2
  • 36
  • 40
robert
  • 3,539
  • 3
  • 35
  • 56

1 Answers1

1

I've got something better for you, in the registry it stores what drive letter it booted from. HKLM\SYSTEM\CurrentControlSet\Control\PEBootRamdiskSourceDrive

Edit To clarify if the you booted WinPE from a flash drive and it got assigned D:, then the value of that entry would be D:

John112358
  • 98
  • 10
  • This works, however is not there a way to tell the physical disk number of the disk WinPE was booted from? – robert Oct 18 '18 at 09:43
  • For WMI there's Win32_LogicalDiskToPartition, whenever I'm looking for a way to do a query in WMI try WMI code creator https://www.microsoft.com/en-us/download/details.aspx?id=8572 – John112358 Oct 18 '18 at 14:33