我正在寻找一种方法来可靠地检测我何时启动到WinPE 4(powershell)(或WinPE 3(vbs)作为替代),我是从UEFI或BIOS系统启动的吗?(因为我在受限制的环境中没有运行第三方exe)
这会显着改变我在分区布局更改和格式时对Windows部署进行分区的方式.(GPT与MBR等)
我有一个工作是一个适应这样的C++代码使用PowerShell v3的,但感觉还砍十岁上下的:
## Check if we can get a dummy flag from the UEFI via the Kernel
## [Bool] check the result of the kernel's fetch of the dummy GUID from UEFI
## The only way I found to do it was using the C++ compiler in powershell
Function Compile-UEFIDectectionClass{
$win32UEFICode= @'
using System;
using System.Runtime.InteropServices;
public class UEFI
{
[DllImport("kernel32.dll")]
public static extern UInt32 GetFirmwareEnvironmentVariableA([MarshalAs(UnmanagedType.LPWStr)] …Run Code Online (Sandbox Code Playgroud)