需要准备的工具

1:windows iso镜像
2:vmware虚拟机
3:anyburn(光盘刻录和镜像文件管理工具) UltraISO也可以能编辑ISO就行了
4:optimizer(系统优化软件)
5:DISM++(系统优化软件)

下载Windows镜像

安装镜像到虚拟机

按照自己电脑性能调整内存至少给2G最好8G,磁盘至少给60G

image-20250808215549872

选择对应映像
image-20250808215946732

分配空间大小,下面就和虚拟机安装windows一样啦。

image-20250808220203707

安装所需初始应用和系统优化

因为是在虚拟机安装,最后提取虚拟机安装到实体机上所以最好不要为了方便安装VMtools(当然你安装后最后卸载掉也行 ~ v ~ ),我的方法是打开远程远程桌面通过微软自带远程控制来拖入程序(反正最后我也要打开的~)

image-20250808223724555

image-20250808223819418

image-20250809061424336

image-20250809062023255

可以在regedit中该路径下删除对应的有线连接记录HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged

image-20250809062137477

image-20250809062340221

image-20250809062511166

创建install.wim文件

image-20250809075918150

image-20250809131142060

按F2进入bios,调整启动顺序,从CDROM启动

image-20250809063005309

image-20250809063157464

疑难解答->命令提示符

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 清理系统
cleanmgr /sagerun:1
del /q /s %temp%\*
del /q /s C:\Windows\Temp\*

# 卸载不需要的软件
# 配置系统设置
# 安装必要的驱动和软件

# 系统封装准备 (C:\Windows\System32\Sysprep\sysprep.exe /oobe /generalize /shutdown)
sysprep /oobe /generalize /shutdown

dism /capture-image /imagefile:D:\install.wim /capturedir:C:\ /Name:"Windows 10 Custom - YuKiFuHaNe Edition" /Description:"Custom Windows 10 Image by YuKiFuHaNe - August 2025" /compress:max

# 验证镜像完整性
dism /get-imageinfo /imagefile:D:\install.wim

# 检查镜像内容
dism /get-wiminfo /wimfile:D:\install.wim

# 查看镜像大小
dir D:\install.wim

/capture-image

  • 作用:告诉 DISM 执行镜像捕获操作
  • 功能:将指定目录的内容打包成 WIM 格式的镜像文件

/imagefile:D:\install.wim

  • 作用:指定输出镜像文件的路径和名称
  • 说明
    • D:\ 是目标驱动器(确保有足够空间)
    • install.wim 是标准 Windows 安装镜像文件名
    • 这个文件最终会替换原 ISO 中的同名文件

/capturedir:C:\

  • 作用:指定要捕获的源目录
  • 说明
    • C:\ 是整个系统分区
    • 包含 Windows 系统文件、程序文件、用户数据等
    • 这是制作完整安装镜像的必要操作

/Name:"Windows 10 Custom"

  • 作用:为镜像指定显示名称
  • 说明
    • 这个名称会显示在 Windows 安装界面的版本选择列表中
    • 用户安装时可以看到这个自定义名称
    • 建议使用有意义的名称,如 “Windows 10 企业版 自定义”

/Description:"自定义Windows 10镜像"

  • 作用:为镜像添加描述信息
  • 说明
    • 提供镜像的详细说明
    • 便于管理员识别和管理多个镜像版本
    • 可以包含版本信息、制作日期、包含的软件等

/compress:max

  • 作用:启用最大压缩
  • 说明
    • 显著减小最终 WIM 文件的大小
    • 压缩比可达 50-70%
    • 虽然捕获时间会稍长,但节省存储空间

应答文件 (C:\Windows\System32\Sysprep\unattend.xml)

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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?xml version="1.0" encoding="utf-8"?>
<!--
Windows 系统封装应答文件
功能:自动化 Windows 部署过程,减少手动设置
适用:Windows 10/11 系统封装
-->
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<!-- ========== 第一阶段:generalize (通用化) ========== -->
<settings pass="generalize">
<!-- 保留所有设备驱动安装 -->
<component name="Microsoft-Windows-PnpSysprep"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
</component>
</settings>

<!-- ========== 第二阶段:specialize (特殊化) ========== -->
<settings pass="specialize">
<!-- 系统基础设置 -->
<component name="Microsoft-Windows-Shell-Setup"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- 计算机名 (*表示随机生成) -->
<ComputerName>*</ComputerName>
<!-- 注册信息 -->
<RegisteredOrganization>您的组织名称</RegisteredOrganization>
<RegisteredOwner>您的姓名</RegisteredOwner>
<!-- 时区设置 (中国标准时间) -->
<TimeZone>China Standard Time</TimeZone>
<!-- 产品密钥 (可选) -->
<ProductKey>XXXXX-XXXXX-XXXXX-XXXXX-XXXXX</ProductKey>
</component>

<!-- 网络工作组/域设置 -->
<component name="Microsoft-Windows-UnattendedJoin"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Identification>
<!-- 加入工作组 (默认WORKGROUP) -->
<JoinWorkgroup>WORKGROUP</JoinWorkgroup>
<!-- 如需加入域,使用以下配置 -->
<!--
<Credentials>
<Domain>您的域名</Domain>
<Password>加密密码</Password>
<Username>域用户名</Username>
</Credentials>
<JoinDomain>您的域名</JoinDomain>
-->
</Identification>
</component>
</settings>

<!-- ========== 第三阶段:oobeSystem (OOBE系统设置) ========== -->
<settings pass="oobeSystem">
<!-- 国际设置 - 语言、区域、输入法 -->
<component name="Microsoft-Windows-International-Core"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- 系统显示语言 -->
<InputLocale>zh-CN</InputLocale> <!-- 输入法区域设置 -->
<SystemLocale>zh-CN</SystemLocale> <!-- 系统区域设置 -->
<UILanguage>zh-CN</UILanguage> <!-- 用户界面语言 -->
<UserLocale>zh-CN</UserLocale> <!-- 用户区域设置 -->
<!-- 其他可选中文输入法 -->
<!-- <InputLocale>0404:00000404,0804:{81D4E9C9-1D3B-41BC-9E6C-4B40BF79E35E}{FA550B04-5AD7-411F-A5AC-CA038EC515D7}</InputLocale> -->
</component>

<!-- OOBE (开箱体验) 设置 -->
<component name="Microsoft-Windows-Shell-Setup"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- OOBE 页面行为设置 -->
<OOBE>
<HideEULAPage>true</HideEULAPage> <!-- 隐藏最终用户许可协议页面 -->
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen> <!-- 隐藏OEM注册页面 -->
<HideOnlineAccountScreens>true</HideOnlineAccountScreens> <!-- 隐藏微软账户登录页面 -->
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> <!-- 跳过无线网络设置 -->
<NetworkLocation>Work</NetworkLocation> <!-- 网络位置 (Work/Home/Other) -->
<ProtectYourPC>1</ProtectYourPC> <!-- 安全设置 (1=推荐设置, 2=仅重要更新, 3=稍后询问) -->
<SkipUserOOBE>true</SkipUserOOBE> <!-- 跳过用户设置 -->
<SkipMachineOOBE>true</SkipMachineOOBE> <!-- 跳过机器设置 -->
</OOBE>

<!-- 用户账户设置 -->
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>加密密码</Value> <!-- 密码 (建议使用加密密码) -->
<PlainText>false</PlainText> <!-- 是否为明文密码 -->
</Password>
<Description>本地管理员账户</Description>
<DisplayName>管理员</DisplayName>
<Group>Administrators</Group> <!-- 用户组 -->
<Name>Admin</Name> <!-- 用户名 -->
</LocalAccount>
</LocalAccounts>
</UserAccounts>

<!-- 自动登录设置 (首次登录) -->
<AutoLogon>
<Password>
<Value>加密密码</Value>
<PlainText>false</PlainText>
</Password>
<Enabled>true</Enabled> <!-- 启用自动登录 -->
<Username>Admin</Username> <!-- 自动登录用户名 -->
<LogonCount>1</LogonCount> <!-- 自动登录次数 -->
</AutoLogon>

<!-- 首次登录后执行的命令 -->
<FirstLogonCommands>
<!-- 示例:静默安装软件 -->
<SynchronousCommand wcm:action="add">
<CommandLine>msiexec /i "C:\path\to\your_software.msi" /quiet</CommandLine>
<Description>安装附加软件</Description>
<Order>1</Order>
</SynchronousCommand>
<!-- 示例:执行批处理文件 -->
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c "C:\scripts\post_install.cmd"</CommandLine>
<Description>执行部署后脚本</Description>
<Order>2</Order>
</SynchronousCommand>
</FirstLogonCommands>
</component>
</settings>

<!-- 离线映像信息 (可选) -->
<cpi:offlineImage cpi:source="wim:c:/your_image_path/install.wim#Windows 10 Pro"
xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

使用说明

1
sysprep /generalize /oobe /shutdown /unattend:unattend.xml
  1. 修改内容

    • YOUR-PRODUCT-KEY-HERE 替换为您的 Windows 产品密钥
    • YourPasswordHere 替换为您想要的密码(使用 PlainTextfalse 时需使用加密密码)
    • 修改组织名称、所有者信息等个性化设置
    • 根据需要调整时区(示例中使用的是中国标准时间)
  2. 密码加密
    要加密密码,可以使用以下命令:

    1
    C:\Windows\System32\Sysprep>cmd.exe /k %windir%\system32\sysprep\sysprep.exe /? 

    在显示的信息中找到加密密码的方法。

  3. 保存文件
    将文件保存为 unattend.xml 并放置在 C:\Windows\System32\Sysprep 目录下。

  4. 执行 Sysprep
    使用以下命令执行封装:

    1
    sysprep /generalize /oobe /shutdown /unattend:unattend.xml
  5. 注意事项

    • 此文件适用于 Windows 10/11 系统
    • 根据您的系统架构(x86 或 amd64)调整 processorArchitecture 属性
    • 首次登录后执行的命令可根据需要修改或删除