易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 1683|回复: 6
收起左侧

windows 镜像制作 来自 官方文档

[复制链接]
发表于 2021-11-11 11:15:28 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x

% }5 i# o" z; @, Z# m
通过百度,google找到些资料,看到官方制作文档如下:
$ F1 W$ m: }4 m
This example creates a Windows Server 2012 qcow2 image, using the virt-install command and the KVM hypervisor.
  • Follow these steps to prepare the installation:
    • Download a Windows Server 2012 installation ISO. Evaluation images are available on the Microsoft website (registration required).
    • Download the signed VirtIO drivers ISO from the Fedora website.
    • Create a 15 GB qcow2 image:
      $ qemu-img create -f qcow2 ws2012.qcow2 15G' U  Y5 R% {8 l4 d' @/ I
      3 N/ ~$ L+ v9 k" ]: f& _) s

      & L) M+ v1 ~* z- D; G
  • Start the Windows Server 2012 installation with the virt-install command:
    # virt-install --connect qemu:///system \  --name ws2012 --ram 2048 --vcpus 2 \  --network network=default,model=virtio \  --disk path=ws2012.qcow2,format=qcow2,device=disk,bus=virtio \  --cdrom /path/to/en_windows_server_2012_x64_dvd.iso \  --disk path=/path/to/virtio-win-0.1-XX.iso,device=cdrom \  --vnc --os-type windows --os-variant win2k12 \  --os-distro windows --os-version 2012
    / z/ N# [, t5 U
    ) o# Z/ J( o# X: I
    Use virt-manager or virt-viewer to connect to the VM and start the Windows installation.
  • Enable the VirtIO drivers. By default, the Windows installer does not detect the disk.
  • Load VirtIO SCSI drivers and network drivers by choosing an installation target when prompted. Click Load driver and browse the file system.
  • Select the E:\virtio-win-0.1XX\viostor\2k12\amd64 folder. The Windows installer displays a list of drivers to install.
  • Select the VirtIO SCSI drivers.
  • Click Load driver and browse the file system, and select the E:\NETKVM\2k12\amd64 folder.
  • Select the network drivers, and continue the installation. Once the installation is completed, the VM restarts.
  • Define a password for the administrator when prompted.
  • Log in as administrator and start a command window.
  • Complete the VirtIO drivers installation by running the following command:
    C:\pnputil -i -a E:\virtio-win-0.1XX\viostor\2k12\amd64\*.INF
    4 E3 j( u+ z* l5 B- B( j2 I" x
    ' `" ~. ~2 U3 L8 N. R
  • To allow the Cloudbase-Init to run scripts during an instance boot, set the PowerShell execution policy to be unrestricted:
    C:\powershellC:\Set-ExecutionPolicy Unrestricted
    7 J) a( E$ `# i  i! H- g3 z* F* y9 D& _$ X6 Y) @7 I
  • Download and install the Cloudbase-Init:
    C:\Invoke-WebRequest -UseBasicParsing https://cloudbase.it/downloads/CloudbaseInitSetup_Stable_x64.msi -OutFile cloudbaseinit.msiC:\.\cloudbaseinit.msi
    2 v& r1 h: t+ `0 g2 p8 H
    ! m2 ]$ f" x: X
    In the configuration options window, change the following settings:
    • Username: Administrator
    • Network adapter to configure: Red Hat VirtIO Ethernet Adapter
    • Serial port for logging: COM1

      - ?/ M6 |) R0 x( \$ w5 G/ j
    When the installation is done, in the Complete the Cloudbase-Init Setup Wizard window, select the Run Sysprep and Shutdown check boxes and click Finish.
    Wait for the machine shutdown.
    $ q1 P) Z" U, n9 c4 t- N& ?: m# J
Your image is ready to upload to the Image service:
$ openstack image create --disk-format qcow2 --file ws2012.qcow2 WS20123 B9 \% W6 a  G" L/ k0 O% u* ]. z, _; d$ N$ }
2 N5 T6 a: ?: D* P
 楼主| 发表于 2021-11-30 10:09:21 | 显示全部楼层
[DEFAULT]# 创建什么用户以及用户属于什么组.username=Admin          #一般都是改为Administratorgroups=Administratorsinject_user_password=true  # 从元数据中获取密码 (非随机).# 那个设备是可能的配置驱动 (元数据).config_drive_raw_hhd=trueconfig_drive_cdrom=true# 与ubuntu中功能相同的tar命令默认路径.bsdtar_path=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe# 日志等级.verbose=truedebug=true# 日志存放路径.logdir=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\log\logfile=cloudbase-init-unattend.logdefault_log_levels=comtypes=INFO,suds=INFO,iso8601=WARNlogging_serial_port_settings=# 启用最大传输单元和时间同步服务.mtu_use_dhcp_config=truentp_use_dhcp_config=true# 存放用户用于执行的脚本的路径.local_scripts_path=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\LocalScripts\# 服务将会检测以下驱动直到某个能够成功获取元数据.metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService, #可以开启ConfigDrive和httpservice(Openstack)                  cloudbaseinit.metadata.services.httpservice.HttpService,                  cloudbaseinit.metadata.services.ec2service.EC2Service,                  cloudbaseinit.metadata.services.maasservice.MaaSHttpService# 需要执行的插件.plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,        cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,        cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,        cloudbaseinit.plugins.windows.userdata.UserDataPlugin,        cloudbaseinit.plugins.windows.setuserpassword.SetUserPasswordPlugin,        cloudbaseinit.plugins.windows.localscripts.LocalScriptsPlugin# 其他配置.allow_reboot=false    # allow the service to reboot the systemstop_service_on_exit=false
. G; J4 O% e3 ^$ r

9 D/ g2 H8 B  U3 K( y4 P$ b! |8 Y# E8 A( v  _8 h3 e" f
 楼主| 发表于 2021-11-30 10:09:34 | 显示全部楼层
[DEFAULT]
2 M7 \* z- H# S  Y) g  N. ]# 创建什么用户以及用户属于什么组.: u+ Q: D3 l& y! e( ]
username=Admin          #一般都是改为Administrator: e2 d! h* l" T2 M( {8 x
groups=Administrators
9 T2 m2 M+ d$ h: A4 ~; [# {inject_user_password=true  # 从元数据中获取密码 (非随机).
& T( z4 q6 Y9 Y) N1 v! `# 那个设备是可能的配置驱动 (元数据).* W4 I- y3 X3 M* w! O
config_drive_raw_hhd=true
( c* B* C( K* |4 A" g  i7 t) q. A1 sconfig_drive_cdrom=true
2 p: i  N* K: h- R1 G1 e8 H" D# 与ubuntu中功能相同的tar命令默认路径.( Y; A& @' [& z1 w% m5 A7 m5 e
bsdtar_path=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
/ {* Y4 H* F6 ]3 J$ t7 {7 f7 Z# 日志等级.
" }# ^' L# A0 P  K  O3 E" B: C) wverbose=true
# @$ c5 k, y. x6 I. e7 P4 j) Edebug=true% z5 U) F+ ]: m, c5 D4 {
# 日志存放路径.
1 x! `4 R3 n) ]" e) V" X( i5 P. Ilogdir=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\log\$ [6 Z$ a- d9 s$ e6 A% c
logfile=cloudbase-init-unattend.log3 j; A; Z, Y6 w7 p/ U
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN
- T; I, p$ w7 l! Qlogging_serial_port_settings=% @; o" n7 i( R. Q. @2 a
# 启用最大传输单元和时间同步服务.) w; k7 n+ T2 r6 X- J; K8 o
mtu_use_dhcp_config=true( w- u' I6 N; t+ E/ @
ntp_use_dhcp_config=true
- U1 E6 X9 R# P# G8 D3 \# 存放用户用于执行的脚本的路径.
# d7 S6 M1 J! T: M6 l) v: a/ _local_scripts_path=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
2 e2 d$ ~5 B  x2 Z" w  ]+ z# 服务将会检测以下驱动直到某个能够成功获取元数据.
# n, ?: t- X  A9 U& A0 Qmetadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService, #可以开启ConfigDrive和httpservice(Openstack)
* s" y1 N% E. t1 C: V- J                  cloudbaseinit.metadata.services.httpservice.HttpService,+ c1 D1 I* z4 e* q
                  cloudbaseinit.metadata.services.ec2service.EC2Service,: B; f& ^! b9 L0 R$ I6 O
                  cloudbaseinit.metadata.services.maasservice.MaaSHttpService) D' n; ?0 U* \: x( @6 ^
# 需要执行的插件./ z) [2 O6 ^! o
plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,
( [5 X! l) L1 F. v8 `- H) Q: n! w        cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,0 m! E& V6 W( n6 _4 D4 Y
        cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,
5 g8 L; R/ E7 P/ \1 S) o" s        cloudbaseinit.plugins.windows.userdata.UserDataPlugin,! p0 V1 r$ j9 k/ Q9 Z: n. l0 B( X% f
        cloudbaseinit.plugins.windows.setuserpassword.SetUserPasswordPlugin,
  L- W9 t7 m, I, H( u' t        cloudbaseinit.plugins.windows.localscripts.LocalScriptsPlugin
9 Q6 t* r2 }. G0 F+ d4 H# 其他配置.( M' k7 k. [7 v) Q& |% _* ]6 i; I
allow_reboot=false    # allow the service to reboot the system/ G, K8 a3 K+ c# U$ d5 P9 ]
stop_service_on_exit=false
: _  P' d/ G6 G- t* M# P2 Q, O; s* i2 b
% V" c2 F' o" J, ?
 楼主| 发表于 2021-11-30 10:20:11 | 显示全部楼层
<?xml version="1.0" encoding="utf-8"?>3 h3 u( P% g2 x) v4 s
<unattend xmlns="urn:schemas-microsoft-com:unattend"># p6 ^0 K" b% L  R: c, V
<settings pass="oobeSystem">
+ c: A' z6 [# _% N6 v<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">
: G2 `, e2 v( o! _/ J<InputLocale>zh-CN</InputLocale>
3 V& U* V6 I# ~6 J8 ?<SystemLocale>zh-CN</SystemLocale>- q  N2 o  y- e/ K
<UILanguage>zh-CN</UILanguage>
% q; {! }* B+ @8 X. ?; b<UILanguageFallback>zh-CN</UILanguageFallback>6 q3 d. b  I; y' ]
<UserLocale>zh-CN</UserLocale>6 M$ o3 m6 p5 H' g, W# j8 U
</component>
" z. y$ o' T6 |  e. B<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">' N4 {7 `$ U1 h7 A
<AutoLogon>
6 f( y6 o" p9 ?$ z' F$ x( |<Password>/ \7 u# k5 b4 I! f
<PlainText>false</PlainText>
2 p0 D4 F. X; s<Value>YgBvAGMALgAxADIAMwBQAGEAcwBzAHcAbwByAGQA</Value>6 h. O8 e( u3 H5 c" R2 b
</Password>
  ~& }; ^# {: s0 V1 p<Enabled>true</Enabled>& d; C& e/ d8 c0 h1 t. ]' x6 {
<LogonCount>1</LogonCount>
; b! B; F) O4 l' U' j& j<Username>administrator</Username>/ W7 a; }* k/ s% T' Q7 s) E' v
</AutoLogon>
. W* r" i" K3 C. R; g* W<OOBE>( D+ E. _) v; {" u% h; N$ K# `
<SkipMachineOOBE>true</SkipMachineOOBE>0 r2 t, Z- {$ a$ I
</OOBE>
  F/ O' }& O# w3 S( G$ a<UserAccounts>
9 J. q8 @4 w, d# c; m<AdministratorPassword>3 E3 B; f) v6 a* X( x+ ~
<Value>YgBvAGMALgAxADIAMwBBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByAFAAYQBzAHMAdwBvAHIAZAA=</Value>
' Q3 \! M9 f& x& {; q1 O<PlainText>false</PlainText>
0 R/ x2 N' E6 N</AdministratorPassword>" E& F8 w  ^  U* R$ y# z' |  n4 y
</UserAccounts>% w) D# Q' B! o. H2 h/ z
<FirstLogonCommands>1 N& }  [! t) s
<SynchronousCommand wcm:action="add">+ {; L, b" _; \' L( C  ~0 g9 P
<Order>1</Order>
) J5 L7 U  O# q% U; X& G* a6 y( D( y<CommandLine>%WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe c:\m.ps1</CommandLine>
/ E9 _3 ?+ ^% ~</SynchronousCommand>. C$ ^* ~$ ^9 ?. ^) b; q3 @
</FirstLogonCommands>
( Z/ @/ J4 P- s+ P' g1 ~' e. k</component>
8 w7 i- |/ s$ [1 ~+ f1 ?8 i</settings>3 |9 i6 e: A* x5 ?
<settings pass="specialize">3 K1 y" u5 W1 L0 F! {2 k5 g
<component name="Microsoft-Windows-Security-SPP-UX" 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">5 o0 H* p9 z# Z6 ^% E4 O% L
<SkipAutoActivation>true</SkipAutoActivation>4 S" a  t" C$ S( X5 I& ]8 h
</component>
; J6 x; F3 f! `& v<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">% `! _0 Y, {/ [( W; B
<ComputerName>PCname1</ComputerName>! R: M2 H) l( w! c) [  ?# n$ L
<TimeZone>China Standard Time</TimeZone>
8 U7 h  w, E4 ^</component>( Y& c. Q) Z2 e( a
</settings># R0 F  l6 }: G$ p# d9 l
<cpi:offlineImage cpi:source="catalog:e:/isotest/win2008r2_en_windows server 2008 r2 serverenterprise.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
& K: I, n6 w8 A/ Y/ `1 D& H! K</unattend>* G7 T- Z3 X2 x
 楼主| 发表于 2021-11-30 10:21:18 | 显示全部楼层
<?xml version="1.0" encoding="utf-8"?>
# L: n$ v. K7 W0 ~5 l4 Q6 p6 V<unattend xmlns="urn:schemas-microsoft-com:unattend">
# Y+ e3 L; G. c( g4 ~+ R) v$ X    <settings pass="windowsPE">
' m4 k/ ~3 D8 ?2 T; I2 ~( g  I, n0 E        <component name="Microsoft-Windows-International-Core-WinPE" 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">
/ T+ _9 K3 V# K3 _- S; j            <SetupUILanguage>' D" \: ~; v( J% r  |* ?
                <UILanguage>en-US</UILanguage>
- g, n; x$ Z5 s" X$ ~: W, C            </SetupUILanguage>
/ a* P4 d. l) w4 @& x, Z            <InputLocale>en-US</InputLocale>
. M& E- M: b1 c( ?) `7 z            <SystemLocale>en-US</SystemLocale>
3 c( |9 h. S" p4 N  {) [( k            <UILanguage>en-US</UILanguage>& v8 g8 }  K  B5 m- N* O( p
            <UILanguageFallback>en-US</UILanguageFallback>
  t+ l8 T! e( P0 e9 z            <UserLocale>en-US</UserLocale>+ i5 @& r- Y7 B; T
        </component>  M5 [, L' _1 ]( O
        <component name="Microsoft-Windows-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">/ ^2 t7 |- _: w7 q3 o
            <ImageInstall>
8 V6 l: W/ J! E8 f" p: D& I7 z; C0 S                <OSImage>
/ i  d& v6 k2 G% l! E' t* e5 V, s                    <InstallTo>1 k; ]( |# ]2 R( g( Y( T
                        <DiskID>0</DiskID>" \# Z9 }! ~& L7 m
                        <PartitionID>2</PartitionID>
$ V! F" d8 _- P- j3 {6 Q: s$ a4 [                    </InstallTo>, l2 k! A! L+ s
            <InstallFrom>
2 v; M/ g$ @7 L1 |) q( r* T+ h- R0 T            <MetaData>
- Z+ I( x! r7 p5 e                <Key>/image/name</Key>/ y4 U1 w+ H  z7 t  I; ]
                <Value>Windows 10 Enterprise</Value>6 ~% }' g  p$ G4 W  A1 I/ t: u
            </MetaData>
+ Q* i* Q) c, t( Q, \9 ?            </InstallFrom>            
; Q  k. A8 B; V. E8 F3 d& [+ T                    <InstallToAvailablePartition>false</InstallToAvailablePartition>6 d! a. O1 l- h  T
                    <Compact>false</Compact>
2 A. p# l# U! S6 L2 ~; [                </OSImage>
% x, G2 C& {3 X2 Y            </ImageInstall>5 P1 ]9 C  c6 Z% N4 }7 Q& c
            <UserData>
7 r" C! A# R3 Q2 O/ I                <AcceptEula>true</AcceptEula>
* d* v, G1 E" K8 {) m4 m( j7 x                <FullName>Administrator</FullName>
, G: Z) S" W) N' B                <Organization>MyOrg</Organization>5 m( w7 \2 _2 ]* [! h" g" e
                <ProductKey>4 O! m/ j0 w7 C8 o( W) [3 R/ D2 p
                    <Key>1ProductKey</Key>
& o' c, M7 t* M# b& I                </ProductKey>
7 q6 K% i- f, T# _' |            </UserData>; L# x7 f3 v1 A4 M; L
            <EnableFirewall>true</EnableFirewall>
- h0 R2 `/ ~7 p7 O) V6 \            <DiskConfiguration>
; j% U, ?- O( W/ C4 z" X                <Disk>& W, F, [. ~& Z, r0 d
                    <CreatePartitions>
5 Y" z: K2 y9 e5 B3 b8 M% E) r& `2 v                        <CreatePartition>
" W& `9 `2 i; \. O7 O5 ~6 P                            <Size>500</Size>
# [0 M$ i1 j, C" S                            <Order>1</Order>' |. s. r" O4 Y& c' K* l
                            <Type>Primary</Type>
% V& z: V0 c' f; g/ y, y                        </CreatePartition>
  s% I; q3 Z- w6 V9 y                        <CreatePartition>
7 F6 T, X& @0 V8 z2 S( o1 P- A                            <Order>2</Order>
! ~; U4 V! t6 q. y+ U/ N2 w                            <Extend>true</Extend>
6 G: v- O! H9 l, J9 O                            <Type>Primary</Type>% Z+ @3 ]0 Y/ K% Z4 J; a+ E5 P- n
                        </CreatePartition>5 D1 `; T0 F) Z; y* s
                    </CreatePartitions>
! U$ a7 k0 `* x) C! L                    <ModifyPartitions>
. h$ S! G1 O: j# `8 I7 F                        <ModifyPartition>+ [0 e& h+ k" x4 U* q6 F
                            <Active>true</Active>7 p5 J# m( Y/ x  k& m. Q7 Z1 Z
                            <Extend>false</Extend>
4 |8 L4 N8 u- D; ^* v( X! j                            <Format>NTFS</Format>* \- q! K7 I. i2 s& {5 G0 U2 z
                            <Label>System</Label>" k; L8 i1 U# N. V! F
                            <Order>1</Order>% z! f8 N  g6 D' p
                            <PartitionID>1</PartitionID>
; W' d. k; t( Q' \/ z                        </ModifyPartition>
, Y- e; L+ A/ a* c                        <ModifyPartition>9 Q  k. d8 W6 p, I/ E/ P
                            <Active>false</Active>
# Z& ?  U3 T4 N/ _                            <Extend>false</Extend>" n/ k0 i( E* B1 j# f  ^* e, E
                            <Format>NTFS</Format>
$ n6 N$ P( Z! |9 Y% O                            <Label>OS</Label>7 }% \: B- N8 u
                            <Letter>C</Letter>
. g- F% t0 m& c  w  {                            <Order>2</Order>
8 j" D5 S6 Y) @- ]- T7 [" X                            <PartitionID>2</PartitionID>+ M# v, p0 T6 J! Y9 `: D- i
                        </ModifyPartition>
9 T# f, G* W5 ?6 w! V5 Y( L" a                    </ModifyPartitions>
* B" I, n6 Y. B4 m% d6 S" ~5 i  Q                    <DiskID>0</DiskID>
/ A& a1 `/ K- r# n) c8 y* d3 H                    <WillWipeDisk>true</WillWipeDisk>- F1 m- V) L2 R7 C' B
                </Disk>
' c, C* Y# l3 P4 e  X; P                <WillShowUI>OnError</WillShowUI>
; S. I. |: V2 z* f/ v1 e6 _            </DiskConfiguration>; b& y6 x( E. C& i% b
        </component>( M+ W+ y. J) G8 q* ^3 n0 \2 A
    </settings>6 ]5 D- K) ~% Z" V- X/ ]; D$ ?
    <settings pass="offlineServicing">
4 S5 x6 S0 S. u( ~& }9 |' e        <component name="Microsoft-Windows-LUA-Settings" 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">
: O% ]  b, o; {0 ~( ^8 Z            <EnableLUA>false</EnableLUA>( [3 M8 t) _( j( k$ }. j2 X- d
        </component>
! u' H: j7 C7 P' j' i    </settings># l+ {" a  ?( u& [  F4 G" w6 J
    <settings pass="generalize">: n! C( C+ Z# @" Q0 p$ Y5 F- l, \
        <component name="Microsoft-Windows-Security-SPP" 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">
6 s0 _0 [% Q- C0 C- L$ d, g/ h            <SkipRearm>1</SkipRearm>3 q$ ?; }; }  w  W" z1 J0 {. y9 J3 R
        </component>* A# R% p' L; [1 d
    </settings>9 C5 ]8 f+ q1 T
    <settings pass="specialize">- h2 `$ H( @7 {/ j& ^4 U' B
        <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">
8 p1 W0 T% B: f5 D, x            <Identification>
& O) W( j" Z# N1 c                <Credentials>! }! \+ |9 _+ J
                    <Domain>1Domain</Domain>
) N9 o: q+ q' [1 b3 B* U+ f                    <Password>1DomainJoinPW</Password>
1 Y0 e( k5 U0 h                    <Username>1DomainJoinAcct</Username># \8 [& d) d# q+ y; @# a: b  q
                </Credentials>- t( m. C; u3 l0 S: v; B; M# o$ `
                <JoinDomain>1FQDN</JoinDomain>
5 l9 V$ m" \! P# b                <MachineObjectOU>1OULocation</MachineObjectOU>. e, W; P+ L/ Y( m4 c( k
                <DebugJoin>true</DebugJoin>
- D1 e4 f9 Z6 t) `7 ?            </Identification>
: @9 @6 J0 F$ h% A! Z  {        </component>  |' d8 [. _2 e6 q' ~; n* ^
        <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">0 E, g6 o" E! O/ a$ E
            <ComputerName>1ComputerName</ComputerName>
2 I4 v. V! u1 O; p" f, v  J            <AutoLogon>4 c1 @9 A6 j: g* Y! Y1 y+ N) r
                <Password>6 }# s" H4 q1 Z; D) r
                    <Value>1AutoLogonPW</Value>( A  M7 L& z9 Q4 o  W8 P. H! g
                    <PlainText>true</PlainText>
5 C, V% G1 g2 e5 |                </Password>
7 z! H. c$ d7 O- e2 e9 I) K                <Enabled>true</Enabled>
1 w8 G) h6 k) b8 C, }                <Username>1AutoLogonAcct</Username>/ A4 J1 K1 G7 v
                <Domain>1Domain</Domain>
: u' K! m) k7 i% [, X8 o9 G            </AutoLogon>; ~+ ^* a; L0 b/ ?" e: ~' }
            <RegisteredOrganization>MyOrg</RegisteredOrganization>
6 s" Q) e1 R0 j% R8 W( r+ W5 ]) b3 I            <RegisteredOwner>Administrator</RegisteredOwner>
- D6 Z" g/ W# _) ?: L( C            <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
' N& ~: z; K  s, P+ j+ n            <TimeZone>Central Standard Time</TimeZone>% Z% B9 b, k5 x, [$ i& V# D
        </component>
3 w3 n; V) v* J& \/ U        <component name="Microsoft-Windows-IE-ESC" 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">' |! J/ z% T5 L2 B1 s4 r
            <IEHardenAdmin>false</IEHardenAdmin>% Q, o7 s4 `% P* ^+ u
            <IEHardenUser>false</IEHardenUser>
8 t8 n* p. i7 G2 e( C        </component>" F( u) G$ E! c0 H" o. t- h
    </settings>
+ l1 L9 D# L9 q, t1 H    <settings pass="oobeSystem">: W. F; w% k* D& B9 H; u! P
        <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 ">
9 e& K, \7 B' |; l; r% ~% [$ m: f. T            <OOBE>
6 B+ N7 x5 b4 w0 X0 M4 t                <HideEULAPage>true</HideEULAPage>" A1 ?7 K" L- c0 v( P" K/ _
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
" Z5 W& `' H5 ~0 b* v                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
8 }9 _7 [" W9 _/ C$ S  q7 a                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
" q3 |6 p( p9 @' C; Z                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
% G" m! ]3 d$ r$ J" S                <NetworkLocation>Work</NetworkLocation>% }- R: k9 Z. g- P9 v
                <ProtectYourPC>1</ProtectYourPC>! K' T& G* d) W8 m/ d' F4 q3 s+ @% w& L
                <SkipMachineOOBE>true</SkipMachineOOBE>5 l6 f7 L5 ~9 q$ `
                <SkipUserOOBE>true</SkipUserOOBE>
+ d- S2 X) g2 R8 i. Y6 @            </OOBE>
$ {5 Z4 Y% f5 z* X2 Z* y0 e/ j            <LogonCommands>9 x0 A3 D, m6 T, l0 h( Q
                <AsynchronousCommand>
' @# @- E% E9 Y/ b                    <CommandLine>powershell -NoLogo -ExecutionPolicy Bypass -File 1DeploymentScript</CommandLine>
& N3 F1 ~; k; ], y2 _                    <Description>Installs components</Description>
; T& `9 F( z6 Q                    <Order>1</Order>9 I0 m2 `  Q8 T5 D' s1 i3 [
                </AsynchronousCommand>
. `9 [& k* v' e; V6 [            </LogonCommands>
" K8 c& v$ u. S% n2 J            <UserAccounts>4 C9 e5 t( \- U5 L7 j! t: \. x
                <AdministratorPassword>2 s% ?3 R4 [! S: U
                    <Value>1LocalAdminPW</Value>
5 N3 y- L8 `. \& F- T4 K                    <PlainText>true</PlainText>
' ]! R6 F, S8 i, K                </AdministratorPassword>: T# v; \! {8 `, i# ]
                <DomainAccounts>
0 {* D$ }7 P  `: H( \: y4 H                    <DomainAccountList>
- m) {: e: R% T" ]0 C" b                        <DomainAccount>
- w& }# W# F& @4 C                            <Group>RemoteDesktopUsers</Group>, j" z. }; z/ f0 j0 K; @- P
                            <Name>Domain Users</Name>) T0 ]9 |; r9 z
                        </DomainAccount># V& W( A7 R( [: X+ E
                        <Domain>1Domain</Domain>
( F6 t, o) }" a3 [                    </DomainAccountList>
# \; h) f7 Y0 c2 U& o                </DomainAccounts>
9 V% B2 ^! ^% q3 x            </UserAccounts>6 @! ?" d5 V' p$ O4 U) P5 E, Q6 W
        </component>' y/ c, q: `) Y2 T
    </settings>
0 O' N! J7 w: d& e9 H</unattend>
 楼主| 发表于 2021-11-30 10:22:38 | 显示全部楼层
执行命令”C:\Windows\System32\sysprep\sysprep.exe /generalize /oobe /unattend:Unattend.xml”,对Windows系统进行封装。执行完该命令后,云服务器会自动关机。
 楼主| 发表于 2021-11-30 10:25:06 | 显示全部楼层
将制作好的应答文件unattend.xml拷贝到模板机sysprep目录下,然后在cmd下运行 (unattend.xml文件可自定义名称)
  sysprep /generalize /oobe /shutdown /unattend:Unattend.xml
Windows2019版本<?xml version="1.0" encoding="utf-8"?>
/ i- Y" ]/ Q' O9 N<unattend xmlns="urn:schemas-microsoft-com:unattend">
  w. p) U% K/ w' @7 I- @; ?    <settings pass="windowsPE">
5 [" ?$ X4 w; f9 u2 t0 ?  V' s7 a        <component name="Microsoft-Windows-International-Core-WinPE" 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">/ l) V3 d9 _  m% o
            <SetupUILanguage>
; h2 q, b* T9 c                <UILanguage>en-US</UILanguage>
5 K/ f3 z2 v. A" D4 Z8 c                <WillShowUI>Never</WillShowUI>6 ?% Y0 F& G0 C1 |) q  A  ]% u8 k
            </SetupUILanguage>
1 l# p2 W8 I! M3 `; V1 }            <InputLocale>en-US</InputLocale>
9 ~; t; y6 w' h  S* n            <SystemLocale>en-US</SystemLocale>
3 {4 j6 k6 q9 s0 k& |7 X            <UILanguage>en-US</UILanguage>& a$ a" a6 d% X5 I
            <UserLocale>en-US</UserLocale>
7 P' N, `* B- k; ~) E+ V" ^        </component>
/ t: J  d( @. n. }/ w        <component name="Microsoft-Windows-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">
' T7 G. i4 f! T0 q, H8 E0 p            <UserData>
) o" ], {& g% J- C* n3 p0 `7 N% y& E                <AcceptEula>true</AcceptEula>! E9 E- G* k; p- M- v" b, g
                <ProductKey>% u% r3 c7 v; e! q3 E% \* U5 t# J
                    <Key>11111-22222-33333-44444-55555</Key>  o4 X$ [$ j$ p1 `, `/ q
                    <WillShowUI>Never</WillShowUI>
" [5 \* u+ f. P( }: y/ _* ^                </ProductKey>8 ]8 u5 w5 `; U$ p; _& P, i
            </UserData>* @6 }, V6 B+ \2 V3 G' i
            <EnableFirewall>true</EnableFirewall>
8 b" y/ J* {6 O- ]8 T% @: n4 c1 e* Z        </component>
" x9 Q7 [. A8 E* n0 n  M4 I# {3 X' M9 u    </settings>" S8 w3 D4 x, _
    <settings pass="specialize">% q) X# c# Z2 l
        <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">
, e2 m( y" p3 G' }3 b            <TimeZone>Central Standard Time</TimeZone>* C0 x8 Y2 w) D) g$ a
        </component>
' Q+ L  X/ m- t5 ?    </settings>
4 I3 ~# M6 x( o6 W    <settings pass="oobeSystem">- [. ~' m+ [* Z$ x8 g4 b! o2 {
        <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">
0 e) F/ y* v$ }1 V/ M0 _            <AutoLogon>4 t: F8 S$ u$ e4 a
                <Password>
7 h% h& E/ e# e- H9 ]0 H                    <Value>PASSWORD123!</Value>8 {: |* g+ P. V9 q
                    <PlainText>true</PlainText>. t: {6 a- J& H8 V: x$ h0 A
                </Password>
) _4 ?8 q* ?  E( `                <LogonCount>2</LogonCount>* M- M* B: t5 |$ Y2 f/ a5 R: U) k
                <Username>Administrator</Username>
7 \9 ^: g/ t. C" `                <Enabled>true</Enabled>5 f$ n! T6 r3 K) O8 \
            </AutoLogon>9 s( m3 F: `$ o
            <UserAccounts>
1 b2 h# [/ C3 y/ C                <AdministratorPassword>: G' z) K# T1 b+ |, n* A: S, r4 f
                    <Value>PASSWORD123!</Value>- j/ Y4 I6 |+ ]: v5 T5 |
                    <PlainText>true</PlainText>
2 E1 E: _5 X6 Y7 @* ^3 q3 W- h0 A                </AdministratorPassword>
0 z: W: ?( C  l+ ^& G) Q* K" m  ~) y            </UserAccounts>% r& D/ i2 F4 d1 V; @7 B$ p
        </component>
! ?5 \1 G5 r  {    </settings>2 u* p* p& [# l8 @1 r0 V
    <cpi:offlineImage cpi:source="wim:c:/users/admin/documents/test/win%20srv%202019/sources/install.wim#Windows Server 2019 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" />; T) S0 C; q9 ?  _+ i
</unattend>
6 w+ U/ L3 f7 F; f+ N" @
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 点击这里给我发消息

GMT+8, 2026-4-8 15:20 , Processed in 0.151934 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表