标签: winpe

如何检测WinPE(4)是否已从UEFI或BIOS启动?

我正在寻找一种方法来可靠地检测我何时启动到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)

c# powershell automation winpe efi

8
推荐指数
1
解决办法
5357
查看次数

winpe的BCD条目仅启动准备自动修复

我正在尝试将计算机重新启动到包含Windows PE的闪存驱动器介质中,但每次只启动准备自动修复.这是我的powershell生成新的bcd条目:

$drive = (get-location).Drive.Name + ":"

$output = bcdedit /copy '{current}' /d "automaticabd"

$variable = "{" + $output.Split('{')[-1]
$variable = $variable.TrimEnd('.')

"Attaching $variable to device partition $drive"
bcdedit /set $variable device partition=$drive
""
"Attaching $variable to osdevice partition $drive"
bcdedit /set $variable osdevice partition=$drive
""
"Setting $variable path to EFI: \EFI\Boot\bootx64.efi"
bcdedit /set $variable path \EFI\Boot\bootx64.efi

""
"Other settings..."
bcdedit /set $variable systemroot \windows
bcdedit /set $variable winpe yes
bcdedit /set $variable  recoveryenabled No

bcdedit /bootsequence $variable
Run Code Online (Sandbox Code Playgroud)

所有操作都已成功完成,看起来好像条目是正确的:

在此输入图像描述

但是,当我重新启动计算机时,我曾经收到消息"修复自动恢复",然后最终进入Windows恢复环境.我已经添加 …

powershell winpe bcdedit

7
推荐指数
1
解决办法
339
查看次数

如何从脚本检测启动的 USB 驱动器的驱动器号?

我正在从可引导 UFD 启动 WinPE 2,我需要检测驱动器号以告诉 ImageX 在哪里可以找到 WIM。但是,根据我正在成像的机器,安装了不同的驱动器。

我需要一种方法来始终如一地将 UFD 安装在 P: 或其他位置。有没有办法检测启动机器的驱动器号,或者有其他方法将我的 WIM 文件的位置传递给可从 startnet.cmd 访问的变量?

这是 TechNet 上有同样问题的其他人。

http://social.technet.microsoft.com/Forums/en-US/itprovistadeployment/thread/3e8bb8db-a1c6-40be-b4b0-58093f4833be?prof=required#

deployment vbscript batch-file winpe

5
推荐指数
1
解决办法
1万
查看次数

C++ 程序没有输出

首先,很抱歉,如果这是错误的类别,因为我不确定这个问题的原因是什么。

出于教育目的,我创建了一个小型“Hello World”应用程序

#include <iostream>
int main() {
    std::cout << "Hello World\n";
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我尝试使用 Visual Studio 和 MINGW-64(g++ -m64 main.cpp) 将其编译为 64 位应用程序。它在我的 Windows 计算机上完美运行,但是当我尝试在最新的 Windows PE 中运行它时,它不会打印出任何内容。我也尝试过使用 std::cin 以便程序不会立即停止,但同样的事情发生 - 没有输出,也没有错误。 在此输入图像描述

我知道 WinPE 在包含的库和子系统方面非常有限,但我真的认为这个简单的 Hello World 应用程序可以运行。WinPE环境是64位的,这就是为什么我编译为64位

有什么想法我应该从哪里开始吗?

c++ cout winpe

3
推荐指数
1
解决办法
3772
查看次数

使用 Oshi Java 库获取 Windows PE 的硬件和操作系统信息

我无法在 Windows PE 上运行我的 Java 应用程序。基本上,我的应用程序获取硬件数据和操作系统信息。为此,我使用了 Oshi Java 库,但 Oshi 使用了不断崩溃的 JNA 库。

注意:我的应用程序在任何其他操作系统上运行良好,但无法在 Windows PE 上运行。我正在使用的代码如下:

HardwareAbstractionLayer hal = si.getHardware();
OperatingSystem os = si.getOperatingSystem();

hal.getComputerSystem();
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激。

java jna winpe oshi

2
推荐指数
1
解决办法
625
查看次数

标签 统计

winpe ×5

powershell ×2

automation ×1

batch-file ×1

bcdedit ×1

c# ×1

c++ ×1

cout ×1

deployment ×1

efi ×1

java ×1

jna ×1

oshi ×1

vbscript ×1