|
本帖最后由 2013kyj 于 2021-10-9 12:25 编辑
在论坛没有找到在PE上集成Powershell脚本相关的贴子, 所以开个讨论贴!
情况是这样的, 本人使用Wb2, 制作了一个完整版功能的PE, 像.NET , WMI , 都可以完美支持, 唯独没有添加Powershell脚本的支持, 随后通过百度, 股沟,找了一些相关的教程, 但是大多年代久远, 于是我下载最新版的ADK后, 按教程步骤操作, 但总是无法添加成功,会报错, 非常期待路过的高手,若有集成Powershell的成功经验, 欢迎能指点一下, 非常感谢
集成powershell的步骤不是很繁琐, 下面是详细步骤, 欢迎测试:
1.通过下面的链接下载 adksetup.exe, 下载后,双击运行它,跟着向导,可以下载完整的ADK包, 但是太大了,貌似10G以内,
https://download.microsoft.com/download/9/A/E/9AE69DD5-BA93-44E0-864E-180F5E700AB4/adk/adksetup.exe
注意:
不必等待其完全下载, 可以用下面的命令行只安装需要的模块,随后就可以看到C:\Program Files (x86)\Windows Kits文件夹,里面就是自动下载并安装的文件:
adksetup.exe /features OptionId.DeploymentTools OptionId.WindowsPreinstallationEnvironment /quiet
2.把BOOT.WIM文件放到C盘根目录下, 并在C盘下创建文件夹mount, 然后用下面的命令挂载BOOT.WIM
Dism /Mount-Image /ImageFile:"C:\boot.wim" /Index:1 /MountDir:"C:\mount"
3.依次使用下面的命令集成powershell,
Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI.cab"
Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI_zh-cn.cab"
Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFX.cab"
Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFX_zh-cn.cab"
Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Scripting.cab"
Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Scripting_zh-cn.cab"
Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab"
Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell_zh-cn.cab"
Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-DismCmdlets.cab"
Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-DismCmdlets_zh-cn.cab"
4.使用下面的命令提交BOOT.wim的更改
Dism /Unmount-Image /MountDir:C:\mount /Commit
------------------------------------------------------------------------------------------------------------------------------------
报错的信息如下, 提示文件不存在, 但是文件是存在的:
C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools>Dism /Add-Package /Image:"C:\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab"
部署映像服务和管理工具
版本: 10.0.19041.1
映像版本: 10.0.19043.928
An error occurred trying to open - C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab Error: 0x80070002
错误: 2
系统找不到指定的文件。
可以在 C:\windows\Logs\DISM\dism.log 上找到 DISM 日志文件
|
|