Windows 10/11 企业版 G 转制方法

Windows 10/11 企业版 G 转制方法

什么是企业版G

Windows 企业版有很多版本,比如N版(欧盟版),S版(LTSB/LTSC),还有个G版

这个企业版G是什么呢?其实就是微软神州网信政府版而定制的版本,也叫中国政府版

参考:Windows 10 神州网信政府版 官网:https://document.cmgos.com/release_notes/release_notes

Windows 10 神州网信政府版(以下简称CMGE)V2022-L是在 Windows 10 21H2的基础上,根据中国有关法律、法规、标准的规定,针对中国专业领域的需求,定制开发的一个操作系统版本。

1) 产品激活

CMGE产品的激活基于 Windows 10 开发,激活服务器位于中国境内的神州网信数据中心。

2) 系统补丁和升级

CMGE产品的系统补丁和升级服务器位于中国境内且由神州网信技术有限公司提供。

3) 数字证书

CMGE内置中国政府指定数字证书机关的根证书。

4) GB/T 30278-2013

CMGE的系统默认安全设置符合GB/T 30278-2013《信息安全技术政务计算机终端核心配置规范》的要求。

5) 系统精简

移除/禁用了 Windows 自带的办公类、个人助理类、娱乐生活类应用及基于云的服务:

a. 移除了下列应用/服务:

天气、获取帮助、使用技巧、3D 查看器、Office Hub、Microsoft Solitaire Collection、混合现实门户、OneNote、人脉、Store Purchase App、钱包、闹钟和时钟、日历、邮件、反馈中心、地图、Microsoft Store、Xbox、Xbox Game Bar、Groove音乐、电影和电视、Edge、Quick Assist等。

b. 禁用了下列应用/服务:

Cortana、Windows Defender、Administrative Shares、Fax、Windows Media Player、Windows Hello、远程桌面、Application Management、Connected User Experiences and Telemetry、Microsoft Account Sign-in Assistant、Netlogon、Performance Logs & Alerts、Problem Reports and Solutions Control Panel Support、Remote Desktop Services UserMode Port Redirector、Windows Error Reporting Service、Windows 安全中心服务、Windows 许可证管理器服务等。

为什么转制企业版G

不考虑其它原因,只因🐔活企业版G后,使用天数15万天,也就是400年(相当于160坤年~),相当于永久激活

400年,即使 KMS 服务器挂了,也不影响系统激活,而且支持断网激活,不用像数字激活那样必须把主板信息留在微软服务器上

怎样转制企业版G

那么这个版本如何获取呢?可以直接安装,或者从企业版或专业版升级到G版?如何升级到Win10企业版G?Win10企业版G如何激活?

老版本可直接在设置种转换

参考:https://www.jiaochengzhijia.com/win10/7019.html

1709以下部分版本中,直接在设置里面更改以下的密钥即可直接切换成功

Windows 10/11 企业版 G:YYVX9-NTFWV-6MDM3-9PT4T-4M68B

Windows 10/11 企业版 G N:44RPN-FTY23-9VTTB-MP9BX-T84FV

新版本可能无法直接转换

1709以上版本,可能无法利用这个BUG直接切换成功,因此需要使用命令行的方式切换

1
slmgr /ipk YYVX9-NTFWV-6MDM3-9PT4T-4M68B

Microsoft (R) Windows Script Host Version 5.812
版权所有(C) Microsoft Corporation。保留所有权利。

错误: 0xC004F069 在运行 Microsoft Windows 非核心版本的计算机上,运行“slui.exe 0x2a 0xC004F069”以显示错误文本。

不过,一般情况下是不能直接切换的,原因是系统里面没有所需的证书,因此还需要导入证书

错误的转制方式

这种方式虽然错误,但是可以使系统无法更新

导入企业版G证书

可以参考:https://blog.03k.org/post/1803entg.html(https://github.com/kkkgo/EnterpriseGconvert)

本转换程序用于Windows 10 1703+版转换为企业G版
如果你的系统低于1703,则无法使用本程序转换为企业G版
本转换可逆,例如转换后重新导入企业版key可转换为企业版

一行代码转换 企业版G:

1
cmd /c curl https://dl.ghpig.top/https://raw.githubusercontent.com/kkkgo/EnterpriseGconvert/master/EnterpriseGconvert.cmd >EnterpriseGconvert.cmd && EnterpriseGconvert.cmd

执行上述脚本,导入证书后,即可通过导入密钥切换为企业版G

脚本大致原理为:

  1. 使用 certutil 生成脚本末尾为 EnterpriseG.cer(实际上就是个cab压缩包),然后用 expand 解压 cab 压缩包内的证书到 %windir%\System32\spp\tokens\skus\ 目录下

  2. 执行以下命令重新安装证书(许可证文件):

    1
    slmgr /rilc
  3. 安装密钥(同上,略)

当然,你也可以借助 HEU KMS Activator,通过图形界面一键转换

此时,计算机属性中显示的名称为 Windows 10/11 企业版 G

后悔了能转的回来吗

如果后悔了,也可以执行以下命令逆转换回去企业版:

1
slmgr /ipk NPPR9-FWDCX-D2C8J-H872K-2YT43

弊端

使用这种方法转换的系统,是无法使用 DISM 正确读取系统版本的,比如执行以下命令:

1
DISM.exe /Online /Get-CurrentEdition

Microsoft Windows [版本 10.0.19045.2846]
(c) Microsoft Corporation。保留所有权利。

C:\Windows\system32>DISM.exe /Online /Get-CurrentEdition

部署映像服务和管理工具
版本: 10.0.19041.844

映像版本: 10.0.19045.2846

当前版本为:

错误: 0x800f0805

DISM 失败。不执行任何操作。
有关详细信息,请查看日志文件。

可以在 C:\Windows\Logs\DISM\dism.log 上找到 DISM 日志文件

通常情况下会报错(0x800f0805),从而导致系统无法正常安装更新

当然如果你刚好不需要系统更新,倒反想方设法地破坏更新,那可以不用管它

如果你有强迫症,或者担心会影响到一些专业软件的安装,请继续阅读下文


正确的转制方式

上面的这种情况是因为系统内缺乏相关的组件包,缺乏版本识别组件包,即与 EnterpriseG 有关的组件包

因此,我们需要在更改密钥前就把组件包打好,最好是在系统镜像被安装前就把组件包打好,否则会非常麻烦

原理介绍

本教程参考以下两篇帖子:

https://bbs.pcbeta.com/viewthread-1786621-1-1.html

https://bbs.pcbeta.com/forum.php?mod=viewthread&tid=1905800&page=1&authorid=2495899

对于Windows 10/11而言,需要以下几个组件包

1
2
3
4
5
6
Microsoft-Windows-Branding-EnterpriseG-Package
Microsoft-Windows-Editions-EnterpriseG-Package
Microsoft-Windows-Security-SPP-Component-SKU-EnterpriseG-Package
(可以不用)Microsoft-Windows-Editions-EnterpriseG-Package-amd64-zh-CN
Microsoft-Windows-EnterpriseGEdition
Microsoft-Windows-EnterpriseGEdition-Wrapper

另外,安装组件包的获取也是非常复杂,这涉及到Windows 10的系统更新模式——UUP

UUP(Unified Update Platform,即统一更新平台)是微软于2016年推出的更新模式,也是现在Windows的更新方式。

UUP更新机制下Windows的更新方式为增量更新,在UUP的更新机制下Windows更新分为三步:

  1. 下载目标版本与现有版本的组件信息表
  2. 对比两个信息表并生成一个最终表,最终表中包含此次升级中所改动的组件信息
  3. 下载最终表中所需组件并进行安装

另外,从这个UUP推出之后,Windows的更新包体积会比之前的要大很多,因为其内包含了从当前版本号最初的小版本(如19041.1)到最新的版本(如19045.3570)的所有改动。

UUP使得获取最新系统镜像更加方便,尤其是获取一些测试版的系统,我们可以通过UUPDUMP网站获取相关制作工具

希望看的此文的你已经尝试使用 UUPDUMP 构建过 Windows 镜像,如果没有,推荐你试一下,观察一下它的文件结构

言归正传,这个 UUP 和我们转制企业版 G 有什么关系呢?

我们要知道,Windows 系统镜像在 UUP 转换之前,是一个个 ESD 和 CAB 文件,UUP 构建就是将各个 ESD 和 CAB 组件通过 CBS / DISM 合并在一个 install.wim 里面,不同 SKU 版本的 Windows 通过安装不同的 SKU 版本证书来进行区分,本质上,系统底层都是同一个

不信你可以执行下面的命令,查看当前的 Windows 可以转换出哪些版本:

1
2
3
4
5
6
7
8
::显示当前映像的版本
DISM.exe /Online /Get-CurrentEdition

::显示可以将映像升级到的Windows版本列表
DISM.exe /Online /Get-TargetEditions

::转换版本
DISM.exe /Online /Set-Edition:具体版本的SKU

然后微软为了避免你白嫖,就把 企业版 G 默认给取消构建了,这导致你无法通过 MSDN(MVS)、Windows 媒体创建工具、UUPDUMP 直接获取到 企业版 G 的镜像,要想获取只能通过相关分销商,如神州网信政府版

文件去哪里找

神州网信政府版内肯定安装了相关的 ESD / CAB 组件,我们可以将其导出,然后安装到正常版本的 Windows 上,这样转制出来的系统镜像执行 DISM.exe /Online /Get-CurrentEdition 就不会报错了

参考:https://bbs.pcbeta.com/viewthread-1762431-1-1.html

http://bbs.c3.wuyou.net/forum.php?mod=viewthread&tid=414572

Export-System-Packages(无法找到)

当然,所有的组件都是可以在 UUP 官网找到的,毕竟人家企业版G本身也是支持升级的

1
2
3
Microsoft-Windows-Branding-EnterpriseG-Package
Microsoft-Windows-Editions-EnterpriseG-Package
Microsoft-Windows-Security-SPP-Component-SKU-EnterpriseG-Package

这三个包的来源是名为 Microsoft-Windows-EditionSpecific-EnterpriseG-Package 的 ESD 文件

1
(可以不用)Microsoft-Windows-Editions-EnterpriseG-Package-amd64-zh-CN

这个包的来源是名为 Microsoft-Windows-Client-LanguagePack-Package_zh-cn 的 ESD 文件

这两个ESD文件均可在UUP dump网站相应 Build 的文件列表中找到

例如,对于 21H2,从网站里任意一个可用的22000.X 的 Build 里边找,对于当前 Dev 通道(224XX.X)版本,在其相应Build里一样可以找到

重点是还有用于版本识别的包:

1
2
Microsoft-Windows-EnterpriseGEdition
Microsoft-Windows-EnterpriseGEdition-Wrapper

这两个包如果没有的话,同样会导致 DISM 报错

这两个文件去哪里找呢?

实际上,这两个包可以在任意一个累积更新(即之前提到过的那种体积贼大的更新包)中找到

另外,假设当前Windows 11只有21H2有累积更新(22000.X),故如果需要做Dev通道(224XX.X)的企业版G,这个包的两个文件就21H2累积更新里的。

实际操作

确定系统版本

测试镜像:cn_windows_10_business_editions_version_1909_x64_dvd_0ca83907.iso

该镜像为1909,对应系统版本号为18363.418,系统架构是x64,即amd64,我们只需要记住这个的版本号和系统架构就够了

如果不清楚的话,可以用 wimlib infoimagex /info 命令查看:

1
2
wimlib-imagex info install.wim
imagex /info install.wim

当然,DISM++也有相应的功能

下载所需文件

打开 UUP DUMP 网站,这里有两个分流:

UUP dump不忘初心中文站

https://uup.ee/

我们在搜索框内输入18363,在搜索结果中,选择带有 amd64 字样的

https://uup.ee/selectlang.php?id=0bd1dd5f-c97f-4463-bdb6-8410d50c05d8

进入之后,右侧会有个搜索框,下方还有 Windows KB 字样

我们首先搜索

1
Microsoft-Windows-EditionSpecific-EnterpriseG-Package

可以看到

File SHA-1 Size
microsoft-windows-editionspecific-enterpriseg-package.esd dbc1ca34c7a9dd13c9a3ff902fe511b40ede4b50 10.74 MiB

我们点击单元格第二行的链接,跳转到以下界面

https://uup.ee/getfile.php?id=0bd1dd5f-c97f-4463-bdb6-8410d50c05d8&file=microsoft-windows-editionspecific-enterpriseg-package.esd

File Expires SHA-1 Size
microsoft-windows-editionspecific-enterpriseg-package.esd 2023-10-26 09:10:33 UTC dbc1ca34c7a9dd13c9a3ff902fe511b40ede4b50 11 MiB

此时,我们发现这个表格多了一个 Expires,说明这个页面中的下载地址是由时效性的,需要抓紧时间下载

我们点击单元格第二行的链接,可以下载到一个文件名称为 fbeb4cac-60b9-4268-ac6d-7e1d086ceb71 的文件

这个文件名非常难看,我们下载完成后需要在第一时间内把重命名为 microsoft-windows-editionspecific-enterpriseg-package.esd

同理,我们搜索下载 Microsoft-Windows-Client-LanguagePack-Package_zh-cn.esd

还记得那个 Windows KB 吗?我们点击它,找到如下结果

File SHA-1 Size
windows10.0-kb4517245-x64-baseless.cab 03ac55ff1144d64709dcf744efb0cc0d8d949bfd 19.25 KiB
windows10.0-kb4517245-x64-baseless.psf e03072ebae74d2db77c6fb1b4c341cf70653ad9e 40.71 KiB
windows10.0-kb4517245-x64.cab 4250e1db7bc9468236c967c2c15f04b755b3d3a9 20.04 KiB
windows10.0-kb5001680-x64-baseless.cab 2560760b4ca6cd014993bbd63fb9c86c99c63a83 1.05 MiB
windows10.0-kb5001680-x64-baseless.psf f61eb09b24b905177c01d3e4db4607600ccb1591 451.31 MiB
windows10.0-kb5001680-x64.cab 514710520306e86ece6b6975846c174f2331853b 30.28 MiB
windows10.0-kb5003239-x64.cab e44831b1f7aaa83c0a2d787de2be3f2d5ab31535 14.48 MiB
windows10.0-kb5003295-x64-baseless.cab 495a768d72211ef1b64da02935357f50a8e1d3df 86.57 KiB
windows10.0-kb5003295-x64-baseless.psf 2c86cedae635bf1dc4eced2b1492ff7cd1c2d34f 25.68 MiB
windows10.0-kb5003295-x64.cab fa818c714c569d61f2b33a3dd5a5fdf58ac4c22e 3.99 MiB
windows10.0-kb5004245-x64-baseless.cab b3632fac099bdd540a713a24b44c3bee5afcf022 49.68 MiB
windows10.0-kb5004245-x64-baseless.psf 48c42e1c6407824ab39326c863c8f4c2f7aa3d27 2.22 GiB
windows10.0-kb5004245-x64.cab b270994582131df1c36a124ce209c1f2a37331c7 525.4 MiB
windows10.0-kb5004748-x64.cab 1fb8a3780d9bbcbced3fd10067996dbd02ed94c4 14.44 MiB

其中,我们看到有个更新包直接到 2.22 GiB,这也应证了我刚才说的 UUP 补丁较大的观点

需要注意的是,部分补丁为.psf格式的,不能直接解压,需要将文件名相同的.cab也下载下来,使用 PSFExtractor 解包

博客:https://blog.betaworld.cn/archives/5/

项目:https://github.com/Secant1006/PSFExtractor

加速下载地址:https://dl.ghpig.top/https://github.com/Secant1006/PSFExtractor/releases/download/v3.07/PSFExtractor-v3.07.zip

挂载镜像

第一步当然是要将ISO镜像解压到硬盘了,不能直接挂载 ISO 在虚拟光驱里面操作

这里我们解压到 D:\Work

首先,我们需要挂载系统镜像wim文件,如果你的系统镜像部署wim格式的,如esd,得转换成wim之后再操作

1
2
3
4
5
::WIMLIB esd转wim示例
wimlib-imagex export install.esd all install.wim --rebuild --compress=fast
::WIMLIB esd转wim示例(局限性:只能导出一个索引)
DISM.exe /Export-Image /SourceImageFile:install.esd /SourceIndex:1 /DestinationImageFile:install.wim /Compress:fast
::当然,DISM++也有相应的功能

执行以下命令挂载镜像,需要注意,我们不能直接处理联机的系统

1
2
3
4
5
6
7
8
9
10
::切换工作目录
cd /d D:\Work
::新建一个文件夹作为挂载文件夹
MKDIR Mount_Dir
::挂载镜像第1卷到挂载文件夹
::DISM示例
DISM.exe /Mount-Image /ImageFile:"install.wim" /Index:1 /MountDir:"Mount_Dir"
::imagex示例
imagex /mountrw "install.wim" 1 "Mount_Dir"
::当然,DISM++也有相应的功能
解包安装相关组件包

对于上述两个 esd 文件,我们可以通过 DISM、WIMLIB等释放,亦可直接使用 7-zip、Bandizip 解包

此处使用 Bandizip 解包,可以搜索,更加方便

我们将 microsoft-windows-editionspecific-enterpriseg-package.esd 解压到install.wim同目录的entg文件夹下,然后执行以下命令安装组件:

1
FOR %a IN (entg\*.mum) DO DISM.exe /Image:"Mount_Dir" /Add-Package /PackagePath:"%a"

此命令会遍历所有.mum格式的文件,然后将其使用 DISM 作为组件安装到 Mount_Dir 所挂载的系统中

当然,DISM++也有相应的功能

相比帖子的原始方法,这样会安装较多的组件,更加完整,中途有个 update.mum 的文件会提示错误,我们不用管它

Microsoft-Windows-Client-LanguagePack-Package_zh-cn.esd 跳过)

接下来,我们解包累积更新包到 edition 文件夹

1
2
3
4
::使用PSFExtractor解包psf
PSFExtractor.exe windows10.0-kbxxxxxxxx-x64.cab
::把PSFExtractor解包的文件夹重命名为edition
move /y windows10.0-kbxxxxxxxx-x64 edition

这里我版本特殊,只有一个cab文件(windows10.0-kb5004245-x64.cab),直接可以使用解压缩软件解压出三个cab:

C:\Users\Lenovo\Downloads\windows10.0-kb5004245-x64>dir /b
cabinet.cablist.ini
Cab_1_for_KB5004245_PSFX.cab
Cab_2_for_KB5004245_PSFX.cab
Cab_3_for_KB5004245_PSFX.cab
update.cat
update.mum

需要注意的是,这里有三个cab文件,具体哪个是目标文件我们需要一个一个地找

这里发现第2个cab为目标文件,搜索关键字 Microsoft-Windows-EnterpriseGEdition ,发现其内含有两个.mum文件及两个对应的.cat文件共四个文件

1
2
3
4
microsoft-windows-enterprisegedition-wrapper~31bf3856ad364e35~amd64~~10.0.18362.1679.cat
microsoft-windows-enterprisegedition-wrapper~31bf3856ad364e35~amd64~~10.0.18362.1679.mum
microsoft-windows-enterprisegedition~31bf3856ad364e35~amd64~~10.0.18362.1679.cat
microsoft-windows-enterprisegedition~31bf3856ad364e35~amd64~~10.0.18362.1679.mum

这两个.mum无法直接使用 DISM 直接安装,因此我们需要进行手动安装操作

需要注意的是,我们这步得记下这个累积更新包的版本号,如 18362.1679,后面要用到

用命令将这几个文件相关文件放置到 Mount_Dir\Windows\servicing\Packages 下(你最好看得出来这个路径在哪里,Mount_Dir是什么意思)

1
2
copy /y "edition\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.*.*" "Mount_Dir\Windows\servicing\Packages"
copy /y "edition\Microsoft-Windows-EnterpriseGEdition-wrapper~31bf3856ad364e35~amd64~~10.0.*.*" "Mount_Dir\Windows\servicing\Packages"

如果你没有使用 NSudo 等使用最高权限运行 CMD,那么执行以上命令将提示复制出错,我们可以通过 Dism++,在任意一个系统的选项卡下,点击左侧【常用工具】=>【工具箱】=>【文件浏览器】,需要注意的是这个文件浏览器拥有最高权限,这样以后就可以直接手动复制(别告诉我你连Ctrl + C、Ctrl + V都不会)那四个文件到 D:\Work\Mount_Dir\Windows\servicing\Packages(所以说你最好看得出来这个路径在哪里,Mount_Dir是什么意思)

接下来我们要挂载注册表,手动还原这个组件包的安装信息

挂载 D:\Mount_Dir\Windows\System32\config\SOFTWARE 注册表到 HKLM\EntGSOFTWARE(这个注册表对应所挂载系统的 HKLM\SOFTWARE):

1
REG.exe LOAD HKLM\EntGSOFTWARE "Mount_Dir\Windows\System32\config\SOFTWARE"

当然,你也可以手动用注册表编辑器(regedit)操作

导入注册表

关键步骤来了!!!以下的命令不能漏!!!

然后,我们需要回忆累积更新包的版本号,是18363.418吗?错,注意,此处的版本号需要对应累积更新包的版本号,对于此例为18362.1679!!!

1
set EntGEditionVersion=18362.1679

由于上述命令设置的版本号我自己也经常搞错,特给出以下命令无脑自动读取:

1
for /f "tokens=6,7 delims=~." %a in ('dir /b edition') do set EntGEditionVersion=%a.%b

接着,我们需要读取注册表部分键值(%InstallTimeHigh%、%InstallTimeLow%、%InstallUser%)用于后续修改注册表

1
2
3
4
5
6
7
8
9
::OfflineReg读取(原始方式)
FOR /F "tokens=2* delims=:" %%i IN ('OfflineReg.exe "Mount_Dir\Windows\System32\config\SOFTWARE" "Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-Editions-EnterpriseG-Package~31bf3856ad364e35~amd64~~10.0.%EntGPackagesVersion%" getvalue InstallTimeHigh') DO SET InstallTimeHigh=%i
FOR /F "tokens=2* delims=:" %%i IN ('OfflineReg.exe "Mount_Dir\Windows\System32\config\SOFTWARE" "Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-Editions-EnterpriseG-Package~31bf3856ad364e35~amd64~~10.0.%EntGPackagesVersion%" getvalue InstallTimeLow') DO SET InstallTimeLow=%i
FOR /F "tokens=2* delims=:" %%i IN ('OfflineReg.exe "Mount_Dir\Windows\System32\config\SOFTWARE" "Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-Editions-EnterpriseG-Package~31bf3856ad364e35~amd64~~10.0.%EntGPackagesVersion%" getvalue InstallUser') DO SET InstallUser=%i
CLS
echo %InstallTimeHigh%
echo %InstallTimeLow%
echo %InstallUser%
echo %InstallLocation%
1
2
3
4
5
6
7
8
9
10
11
12
::粗略读取
FOR /F "tokens=*" %i IN ('REG QUERY "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages"^|find /i "Microsoft-Windows-Editions-EnterpriseG-Package~31bf3856ad364e35~"') DO (
FOR /F "tokens=3* skip=2" %j IN ('REG QUERY "%i" /v InstallTimeHigh') DO SET "InstallTimeHigh=%j"
FOR /F "tokens=3* skip=2" %k IN ('REG QUERY "%i" /v InstallTimeLow') DO SET "InstallTimeLow=%k"
FOR /F "tokens=3* skip=2" %l IN ('REG QUERY "%i" /v InstallUser') DO SET "InstallUser=%l"
FOR /F "tokens=3* skip=2" %m IN ('REG QUERY "%i" /v InstallLocation') DO SET "InstallLocation=%m"
)
CLS
echo %InstallTimeHigh%
echo %InstallTimeLow%
echo %InstallUser%
echo %InstallLocation%
1
2
3
4
5
6
7
8
9
10
11
12
::精准读取(AMD64)
FOR /F "tokens=*" %i IN ('REG QUERY "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages"^|find /i "Microsoft-Windows-Editions-EnterpriseG-Package~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%"') DO (
FOR /F "tokens=3* skip=2" %j IN ('REG QUERY "%i" /v InstallTimeHigh') DO SET "InstallTimeHigh=%j"
FOR /F "tokens=3* skip=2" %k IN ('REG QUERY "%i" /v InstallTimeLow') DO SET "InstallTimeLow=%k"
FOR /F "tokens=3* skip=2" %l IN ('REG QUERY "%i" /v InstallUser') DO SET "InstallUser=%l"
FOR /F "tokens=3* skip=2" %m IN ('REG QUERY "%i" /v InstallLocation') DO SET "InstallLocation=%m"
)
CLS
echo %InstallTimeHigh%
echo %InstallTimeLow%
echo %InstallUser%
echo %InstallLocation%

建议使用精准读取,如精准读取都不到再用粗略读取

注意:以上的所有 CMD 命令请直接复制粘贴,如需在脚本中使用请手动补上 FOR 命令的两个 %%

如果有几个项目(如InstallTimeHigh、InstallTimeLow),实在读不出来,或后面无法导入到注册表,可以随意设置

1
2
3
::需要设置为10进制,如果是16进制需要写成0x多少的形式
set InstallTimeHigh=31066064
set InstallTimeHigh=417343264

修改注册表,添加封包 Microsoft-Windows-EnterpriseGEdition 相关信息以使系统版本可以得到正确读取

1
2
3
4
5
6
7
8
9
10
11
12
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /v "CurrentState" /t REG_DWORD /d 112
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /v "InstallLocation" /t REG_SZ /d "\\?%WorkDisk%\%LCUName%"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%.mum"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /v "InstallTimeHigh" /t REG_DWORD /d "%InstallTimeHigh%"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /v "InstallTimeLow" /t REG_DWORD /d "%InstallTimeLow%"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /v "InstallUser" /t REG_SZ /d "%InstallUser%"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /v "SelfUpdate" /t REG_DWORD /d 0
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /v "Visibility" /t REG_DWORD /d 1
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%\Owners"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%\Owners" /v "Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /t REG_DWORD /d 131184

如果不能正确写入注册表,可以手动“抄写”注册表的相关键值,相关注册表:

1
2
3
4
5
6
7
8
先用注册表编辑器访问:
HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages
再找到:
Microsoft-Windows-Editions-EnterpriseG-Package~31bf3856ad364e35~系统架构~~10.0.累积更新包的版本号
分别抄下InstallTimeHigh、InstallTimeLow、InstallUser、InstallLocation
HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages下,新建项:
Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~系统架构~~10.0.累积更新包的版本号
分别创建InstallTimeHigh、InstallTimeLow、InstallUser、InstallLocation等(此步建议使用命令修改)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~系统架构~~10.0.累积更新包的版本号]
"InstallClient"="DISM Package Manager Provider"
"InstallName"="Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~系统架构~~10.0.累积更新包的版本号"
"InstallLocation"="【这个需要自己抄】"
"CurrentState"=dword:00000070
"SelfUpdate"=dword:00000000
"Visibility"=dword:00000001
"InstallTimeHigh"=dword:【这个需要自己抄,8位16进制】
"InstallTimeLow"=dword:【这个需要自己抄,8位16进制】
"InstallUser"="【这个需要自己抄,S-1-5-21-后面一大串】"

[HKEY_LOCAL_MACHINE\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGNEdition~31bf3856ad364e35~系统架构~~10.0.累积更新包的版本号\Owners]
"Microsoft-Windows-EnterpriseGNEdition~31bf3856ad364e35~系统架构~~10.0.累积更新包的版本号"=dword:00020070

卸载注册表

1
REG.exe UNLOAD HKLM\EntGSOFTWARE
安装产品密钥
1
DISM.exe /Image:"Mount_Dir" /Set-ProductKey:FV469-WGNG4-YQP66-2B2HY-KD8YX
验证系统版本

目前为止此方式来转换版本,这一步验证都是成功的

1
DISM.exe /Image:"Mount_Dir" /Get-CurrentEdition
复制许可协议
1
2
MKDIR "Mount_Dir\Windows\System32\Licenses\neutral\_Default\EnterpriseG"
COPY /Y "Mount_Dir\Windows\System32\Licenses\neutral\Volume\Professional\*.*" "Mount_Dir\Windows\System32\Licenses\neutral\_Default\EnterpriseG"
卸载映像
1
DISM.exe /Unmount-Wim /MountDir:"Mount_Dir" /commit

到此,该系统镜像就被成功改为企业版G了!

后记

  1. 此方法不一定适用于所有情况,请按照实际情况对脚本进行修改

  2. 此400年激活的BUG不排除有被微软以补丁的方式修复的可能

  3. 若使用 NTLite 等程序手动集成更新,累积更新包(msu格式)可在其更新下载文件夹内找到,无需UUP;若使用 UUPDUMP 自动集成更新,esd和累积更新包(cab或psf格式)均可在 UUP 文件夹内找到

    再理顺一遍,除了系统镜像外只需要准备两个文件:

    1. microsoft-windows-editionspecific-enterpriseg-package.esd
    2. 累积更新包
  4. 实测无需使用最新的累积更新包,即没有必要一直更新edition文件夹,这意味着可以制作通用的转换工具

  5. 本文仅演示了离线系统正确修改的方法,对于已经安装的系统,是否能在PE系统、拥有最高权限的联机情况下,通过导入相关组件来实现版本转换,仍然需要进一步验证

自用PE下离线转换批处理分享

需要准备entg文件夹合edition文件夹(获取方法具体看上面的文章)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cd /d "%~dp0"

set Mount_Dir=c:

@rem imagex /mountrw "windows.wim" 1 "%Mount_Dir%"

dism /image:%Mount_Dir% /Set-Edition:Enterprise

FOR %%a IN (entg\*.mum) DO DISM.exe /Image:%Mount_Dir% /Add-Package /PackagePath:"%%a"

xcopy /e /c /h /r /y "edition\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.*.*" "%Mount_Dir%\Windows\servicing\Packages"
xcopy /e /c /h /r /y "edition\Microsoft-Windows-EnterpriseGEdition-wrapper~31bf3856ad364e35~amd64~~10.0.*.*" "%Mount_Dir%\Windows\servicing\Packages"

echo 如果上一步骤提示失败,请手动复制,否则10000000000%失败!
echo 输入 exit 继续
cmd

REG.exe LOAD HKLM\EntGSOFTWARE "%Mount_Dir%\Windows\System32\config\SOFTWARE"

for /f "tokens=6,7 delims=~." %%a in ('dir /b edition') do set EntGEditionVersion=%%a.%%b

FOR /F "tokens=*" %%i IN ('REG QUERY "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages"^|find /i "Microsoft-Windows-Editions-EnterpriseG-Package~31bf3856ad364e35~"') DO (
FOR /F "tokens=3* skip=2" %%j IN ('REG QUERY "%%i" /v InstallTimeHigh') DO SET "InstallTimeHigh=%%j"
FOR /F "tokens=3* skip=2" %%k IN ('REG QUERY "%%i" /v InstallTimeLow') DO SET "InstallTimeLow=%%k"
FOR /F "tokens=3* skip=2" %%l IN ('REG QUERY "%%i" /v InstallUser') DO SET "InstallUser=%%l"
FOR /F "tokens=3* skip=2" %%m IN ('REG QUERY "%%i" /v InstallLocation') DO SET "InstallLocation=%%m"
)
echo %InstallTimeHigh%
echo %InstallTimeLow%
echo %InstallUser%
echo %InstallLocation%
timeout /t 5
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /f
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /f /v "CurrentState" /t REG_DWORD /d 112
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /f /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /f /v "InstallLocation" /t REG_SZ /d "\\?%WorkDisk%\%LCUName%"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /f /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%.mum"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /f /v "InstallTimeHigh" /t REG_DWORD /d "%InstallTimeHigh%"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /f /v "InstallTimeLow" /t REG_DWORD /d "%InstallTimeLow%"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /f /v "InstallUser" /t REG_SZ /d "%InstallUser%"
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /f /v "SelfUpdate" /t REG_DWORD /d 0
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /f /v "Visibility" /t REG_DWORD /d 1
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%\Owners" /f
REG.exe ADD "HKLM\EntGSOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%\Owners" /f /v "Microsoft-Windows-EnterpriseGEdition~31bf3856ad364e35~amd64~~10.0.%EntGEditionVersion%" /t REG_DWORD /d 131184

REG.exe UNLOAD HKLM\EntGSOFTWARE

DISM.exe /Image:"%Mount_Dir%" /Set-ProductKey:FV469-WGNG4-YQP66-2B2HY-KD8YX

DISM.exe /Image:"%Mount_Dir%" /Get-CurrentEdition

MKDIR "%Mount_Dir%\Windows\System32\Licenses\neutral\_Default\EnterpriseG"
COPY /Y "%Mount_Dir%\Windows\System32\Licenses\neutral\Volume\Professional\*.*" "%Mount_Dir%\Windows\System32\Licenses\neutral\_Default\EnterpriseG"

cmd

免责声明

本 Windows 系统及软件版权属各自产权人所有,只用于个人封装技术研究交流使用,不得用于商业用途,且本系统制作者不承担任何技术及版权问题,请在试用后 24 小时内删除。如果您对本系统有任何意见和建议,欢迎反馈,请购买正版 Windows 操作系统软件!