易陆发现互联网技术论坛

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

windows 镜像制作 来自 官方文档

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

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

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

x

+ v- s) Y8 A, d$ b" [
通过百度,google找到些资料,看到官方制作文档如下:
  [3 k! _( x$ b
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
      $ f& ]9 X& }6 c* W& C( j2 i7 Y, k  X7 E% R

      ' J+ ?& z; a9 K. u7 A1 D
  • 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' o5 E" N4 j: s2 z+ s

    ' L# ~) S+ g, g; E5 L$ {3 K9 t: ?
    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
    ' |5 ]0 {; o/ v# n8 N* J. l, l. Z, g7 O$ R' m
  • 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) u; @8 Z% p! Q9 T3 J$ s# R

    / B! z+ f" M, K0 X, T7 u- q8 G& b
  • Download and install the Cloudbase-Init:
    C:\Invoke-WebRequest -UseBasicParsing https://cloudbase.it/downloads/CloudbaseInitSetup_Stable_x64.msi -OutFile cloudbaseinit.msiC:\.\cloudbaseinit.msi
    : K% D' N0 x' E, t/ q! h$ ]+ Z  o4 w. {) v- c) c1 |7 h
    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
      3 Z3 v5 t- m; }4 G0 o) k: ~
    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.

    % s( s8 a- f. q, |" W
Your image is ready to upload to the Image service:
$ openstack image create --disk-format qcow2 --file ws2012.qcow2 WS20121 d; M& ?2 P0 d! f
7 V9 ?6 N( H, g) i1 a) w
 楼主| 发表于 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
* {2 g* ^& Z6 ?
1 c. z9 o2 R% [8 v
+ `! A1 i$ I& X6 y+ j- U2 P& Y/ @8 z
 楼主| 发表于 2021-11-30 10:09:34 | 显示全部楼层
[DEFAULT]
2 o6 v, U7 f9 t2 K( l" s& d% ]0 e# 创建什么用户以及用户属于什么组.5 ?- c0 @) y+ b# [0 [. U2 G8 V) t
username=Admin          #一般都是改为Administrator9 w4 Y( E3 }, R3 M3 ?. ]5 d( z
groups=Administrators
* [0 b5 U: g* ?0 Y  x$ sinject_user_password=true  # 从元数据中获取密码 (非随机).. v  _' I# |' K6 r$ g/ W) z
# 那个设备是可能的配置驱动 (元数据).
( z) K3 N8 Y4 qconfig_drive_raw_hhd=true" W  ?7 C4 U2 ]; c4 ~- u
config_drive_cdrom=true$ B& {1 p! \! K7 w  e' [
# 与ubuntu中功能相同的tar命令默认路径.
- N( \+ L9 n- Obsdtar_path=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe. ?) w$ F) K  b% T- w4 k) f0 Z: T
# 日志等级.  `, x( ?) A9 C/ t/ X4 T* i
verbose=true
5 y" `2 E" P. d- z; V6 P4 O' r& edebug=true$ A4 r1 R2 a; ]; j. c) M
# 日志存放路径.
6 g: N; Y, E- \2 |+ N$ `logdir=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\log\+ [* w: Y% Y0 k
logfile=cloudbase-init-unattend.log1 B6 u5 b( [! `  F% h
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN
; ^; Q& o: i8 N% H& S% Z' \logging_serial_port_settings=9 E% M& \, b7 ^1 p& r
# 启用最大传输单元和时间同步服务.  ?, `! q8 S  C: v8 O+ h" _" u" A/ Z9 E
mtu_use_dhcp_config=true" {6 v, l" P. n
ntp_use_dhcp_config=true
, w+ [, D8 T! M0 e# 存放用户用于执行的脚本的路径.& O+ e5 ^! z# X/ G: Q
local_scripts_path=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
# s4 o2 G' P1 @7 P# 服务将会检测以下驱动直到某个能够成功获取元数据.4 B  P+ ^, P5 D8 o4 q+ i
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService, #可以开启ConfigDrive和httpservice(Openstack)
& K& i* O3 ~; h* w5 a8 O                  cloudbaseinit.metadata.services.httpservice.HttpService," [7 ]* y3 u9 K) _
                  cloudbaseinit.metadata.services.ec2service.EC2Service,
, x3 ?  T& R8 T* N4 o2 l                  cloudbaseinit.metadata.services.maasservice.MaaSHttpService  x' s8 }# g, H
# 需要执行的插件.. [5 F+ e5 a. C! m! i' X  w
plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,
4 d" O& z9 G% X) s) i        cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,/ y1 h0 y( I+ [) ?2 C
        cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,  U( ~: Q9 [9 g0 A( ^
        cloudbaseinit.plugins.windows.userdata.UserDataPlugin,
! w) I5 O/ c7 C* ^4 a9 T: u        cloudbaseinit.plugins.windows.setuserpassword.SetUserPasswordPlugin,/ M+ K6 k6 U* y; L' H
        cloudbaseinit.plugins.windows.localscripts.LocalScriptsPlugin
$ l/ G6 y, d  P' r1 n% o/ H# 其他配置.  i' V* |: \& ?1 d# ?9 A) q
allow_reboot=false    # allow the service to reboot the system9 I, j3 u- E. }$ `" I; a
stop_service_on_exit=false
  {" d8 r* i4 S) M% v: k8 o. k. B) D
; R6 }/ _6 l, q- O
 楼主| 发表于 2021-11-30 10:20:11 | 显示全部楼层
<?xml version="1.0" encoding="utf-8"?>
* c. z' ?1 n9 a% N, q  G<unattend xmlns="urn:schemas-microsoft-com:unattend">
4 q% v  L5 Q4 |4 y4 `* S<settings pass="oobeSystem">
8 J3 b6 ]  d+ b( z' u9 b5 S<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">
0 z7 t/ N0 E" D& q8 j' L1 p<InputLocale>zh-CN</InputLocale>
3 F& Q2 I- {+ M6 z<SystemLocale>zh-CN</SystemLocale>, m* u7 i  f) M; e2 O4 s" g
<UILanguage>zh-CN</UILanguage>$ m* l6 j) S) J  [2 t8 J$ Q/ a
<UILanguageFallback>zh-CN</UILanguageFallback>0 R" G0 e  P0 q6 f1 e0 _
<UserLocale>zh-CN</UserLocale>
8 _" w2 S) u3 B+ o; ~/ ]* u" A</component>
, K4 i2 [) V$ P. c1 y& t. I* 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">
. C5 G* w1 X3 B7 i5 h# a8 h<AutoLogon>% t, D8 M7 t- y  F; P/ l# \
<Password>3 a7 J) W5 k$ O2 G
<PlainText>false</PlainText>
' k7 M7 d4 ~2 w. S4 O<Value>YgBvAGMALgAxADIAMwBQAGEAcwBzAHcAbwByAGQA</Value>
9 m  b% I0 }4 H9 ^, R# p</Password>
& I; `2 W0 F3 t3 ?* k% H& E<Enabled>true</Enabled>- ?5 i6 x  K8 ]+ A0 M
<LogonCount>1</LogonCount>  C( C" G' ~# O7 ?
<Username>administrator</Username>
5 {2 s1 w' g2 z; P5 f</AutoLogon>, a! V8 M) X4 K0 L1 f
<OOBE>* Q+ V0 G2 s$ {0 ?
<SkipMachineOOBE>true</SkipMachineOOBE>
& ]$ h+ J) W3 o, G% o4 I</OOBE>  u3 B: \; ^! S; B0 u" x" e7 k
<UserAccounts>1 O* f& o: x6 Z: a- R' c$ X5 I
<AdministratorPassword>
+ h6 s5 l4 V' {" y# Y% z<Value>YgBvAGMALgAxADIAMwBBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByAFAAYQBzAHMAdwBvAHIAZAA=</Value>
( i' n  v8 s( M) l. }5 J<PlainText>false</PlainText>9 P0 D( c* D* n7 V
</AdministratorPassword>
- V, P1 t% O3 a( m</UserAccounts>
' n( i- y; a/ q2 D7 v. d3 ?<FirstLogonCommands>
% @) M/ p6 {2 u) I<SynchronousCommand wcm:action="add">
) ]" T+ D  u5 [  Y4 w& [<Order>1</Order>
0 A% M" ^& ^* h% A& j1 E. W9 E<CommandLine>%WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe c:\m.ps1</CommandLine>
& v) J* h4 m& G& y; H7 p! B</SynchronousCommand>- ]& y8 Q! s. f9 I/ j3 x' v
</FirstLogonCommands>
1 _& R0 a6 p9 S$ ]$ J( U( R6 g6 z, ~</component>
1 W7 I# X5 q* k2 P</settings>
# @/ A- {& w2 ^/ v; e<settings pass="specialize">  w* m7 s3 k/ y$ t0 |
<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">
8 o5 F+ v, Z& x( c9 V5 {0 }2 m<SkipAutoActivation>true</SkipAutoActivation>4 \. r7 k+ O! P0 l3 e% q) [/ A
</component>9 D: B0 @2 o$ U5 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">( x; M$ |  t6 m  v' F0 i, H
<ComputerName>PCname1</ComputerName>
2 f5 R' v+ r9 x5 _3 i" g% n; |% {7 {<TimeZone>China Standard Time</TimeZone>) B- a2 p& s, m% j
</component>
5 H# V% K  s4 w% X</settings>
2 ~4 |: T2 h, J) C  h<cpi:offlineImage cpi:source="catalog:e:/isotest/win2008r2_en_windows server 2008 r2 serverenterprise.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
! H( A: a8 C4 d  z3 t5 \' ]</unattend>
( D3 I% V+ H/ }2 [0 G' S, y
 楼主| 发表于 2021-11-30 10:21:18 | 显示全部楼层
<?xml version="1.0" encoding="utf-8"?>" [% T( G. F+ r- ~7 k; {
<unattend xmlns="urn:schemas-microsoft-com:unattend"># A4 M# p( N# Z0 u6 P" f( n* b
    <settings pass="windowsPE">9 F  j. C& p! ~3 N# t) o
        <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">; z4 q: k$ D, B  l
            <SetupUILanguage>  r6 _3 {2 h9 d2 p9 R0 N' K) R) Z7 p. S, k
                <UILanguage>en-US</UILanguage>
, x* {/ B! X1 u6 z            </SetupUILanguage>% R# h* n0 }' r% ^1 r
            <InputLocale>en-US</InputLocale>
+ Y7 p; B4 d5 ~( a4 N& z9 L+ d; m            <SystemLocale>en-US</SystemLocale>
! O/ l/ T" R0 y9 F0 ~# S& Q            <UILanguage>en-US</UILanguage>  V; ~* \, Q: P" ?  r0 g& V3 D
            <UILanguageFallback>en-US</UILanguageFallback>5 }! j: d$ l, v' c9 c" o) f
            <UserLocale>en-US</UserLocale>+ E/ j& k0 s! ?' Z: S. Q+ Y
        </component>
& B2 V$ E: s" M* }/ K        <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">
+ R! Y! O# k. w            <ImageInstall>
+ C3 b1 ]& C8 d& m* B                <OSImage>, X/ H! W) [- ?; s: D' E
                    <InstallTo>+ {) u4 H) ?/ r$ F5 H/ `
                        <DiskID>0</DiskID>3 g2 P0 K( n- p+ u0 G0 ?* Y
                        <PartitionID>2</PartitionID>; f6 t; x9 \' y4 k
                    </InstallTo>
! G/ ~2 C' i  I7 x% E& w* _            <InstallFrom>  u# _  _) f6 W" }
            <MetaData>' C( N, P4 h/ D# S
                <Key>/image/name</Key>, H, b# i5 U. n/ U* i5 \
                <Value>Windows 10 Enterprise</Value>% o! o9 g1 I" i
            </MetaData>3 o! f& d8 d* D/ \6 W' E
            </InstallFrom>            
' e9 ]" L5 @* R  @. x8 l2 A$ i                    <InstallToAvailablePartition>false</InstallToAvailablePartition>
  {, i) q- r9 c                    <Compact>false</Compact>7 ^, ~- j2 V) {/ S# j/ G
                </OSImage>
- ]9 G0 N' Y0 v) F' t1 e            </ImageInstall>
) k4 t. r% L6 f9 C- U( A& w0 m            <UserData>2 C1 H0 B1 p: t" u8 ^) T' |+ u
                <AcceptEula>true</AcceptEula>; n; v, v$ T2 I3 B9 m$ S$ e* w
                <FullName>Administrator</FullName>5 d- L* M, d: f
                <Organization>MyOrg</Organization>
! |6 x3 e4 O! {                <ProductKey>( G  f6 M" d. x, G7 C& `
                    <Key>1ProductKey</Key>
" ~  }( }0 h; q5 O1 r5 P                </ProductKey>. n2 C& o  m7 A' K
            </UserData>
8 j) g8 I2 Y; k  y. i            <EnableFirewall>true</EnableFirewall>9 N; m5 I" i; z; f! d8 P: M: v
            <DiskConfiguration>4 |5 D& \  d3 o9 Y; W' _  Y! g0 X% u
                <Disk>- K7 v& S4 W" r  L4 [& u# \
                    <CreatePartitions>
4 ~3 s6 h& G# H) h                        <CreatePartition>$ C6 `% u1 ]7 g+ b
                            <Size>500</Size>
* B* L) h  |8 W                            <Order>1</Order>/ c# }  u* t2 r" V3 q3 v
                            <Type>Primary</Type>
+ E# h6 c. ^- W: v/ G                        </CreatePartition>, o3 F' Z$ d5 b$ n
                        <CreatePartition>' ~! _) L, L: Z/ ]' f8 h( T
                            <Order>2</Order>
) D0 z6 E' R; L: ^5 X( R% S                            <Extend>true</Extend>4 [8 B' ~; B' M
                            <Type>Primary</Type>
5 r" s* p# j- B  {' y+ ^1 g1 d                        </CreatePartition>
5 R  v: T* ]( }                    </CreatePartitions>) Q# K9 G/ U4 k. x
                    <ModifyPartitions>3 N  M8 q% @1 g) S) }7 Q+ w
                        <ModifyPartition># t! v* T( P3 P$ |2 |
                            <Active>true</Active>
, N, Z8 N4 P* w                            <Extend>false</Extend>8 d* E" M5 v& o
                            <Format>NTFS</Format>
% p6 C$ j; n) Z: R* D* q                            <Label>System</Label>6 F) u/ @6 f( H$ A! s3 [
                            <Order>1</Order>/ g5 Y+ S6 e/ n8 u- M7 W
                            <PartitionID>1</PartitionID>& Z" @3 G. I1 _
                        </ModifyPartition>
1 q0 ~" j# B# R% \                        <ModifyPartition>1 ^  W7 j" j( y4 `' K4 J
                            <Active>false</Active>( e3 V* i1 f' P2 F, f% @
                            <Extend>false</Extend>
. V' {3 R& R2 Y6 @% i                            <Format>NTFS</Format>, _: x  _) ?- T  A
                            <Label>OS</Label>- ^* u3 M5 g( k2 {% j. e
                            <Letter>C</Letter>9 q( A( K6 N; J1 G1 f2 P" X
                            <Order>2</Order>/ I* z" {; J5 H  i- e+ b: y2 M
                            <PartitionID>2</PartitionID>
$ v& G% d' M( T                        </ModifyPartition>. c* b9 d1 W4 @% G# k& ^
                    </ModifyPartitions>7 P# j9 Y- [: k% M) z$ z
                    <DiskID>0</DiskID>/ s7 q) y/ T6 N8 `  i
                    <WillWipeDisk>true</WillWipeDisk>1 V9 ?  R4 _& {' `8 L& T" G* F  ]
                </Disk>
, f5 @) N/ t8 T' j. b. j, B( m5 U                <WillShowUI>OnError</WillShowUI>- j( c: z* |( }- S8 W
            </DiskConfiguration>
6 P5 l4 T& ^7 k$ q# r. M/ J, T        </component>' O& D: u- Q* @) ]
    </settings>( @$ V7 B- X* s" i1 q. p6 Z5 }
    <settings pass="offlineServicing">
7 o7 [. o5 p. D+ D( s0 D9 X: f" I& ^        <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">) X$ x8 N7 W; t; }$ S* K% r3 g) @
            <EnableLUA>false</EnableLUA>
4 X' V. ]9 D/ Y0 D1 K0 |        </component>& \) v" _) H& b  Q
    </settings>
$ l" c4 K4 `5 P( {4 j    <settings pass="generalize">1 L1 @" @8 r- y# n: w7 d% w
        <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">
0 s& \3 x; {6 [            <SkipRearm>1</SkipRearm>
! F- u: F. K2 B  N" H        </component>' m" g' W" F& G1 T8 L2 U" ^+ n
    </settings>
- E6 M# q# G# o6 Z# ?! }) @    <settings pass="specialize">
- z8 g( L' c# i+ P( t1 K        <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">) Q# V, H8 z4 w( v; Q
            <Identification>
8 ~, [! ]  M4 T- R+ g+ M                <Credentials>
6 J0 T0 ~* v- h9 j% c                    <Domain>1Domain</Domain>
% R$ k4 y( N; e) ?4 w. y0 p- Q+ M                    <Password>1DomainJoinPW</Password>0 X2 d* e3 U5 R: s
                    <Username>1DomainJoinAcct</Username>. _& s6 G* K  J
                </Credentials>% K/ P& I6 q. E3 c& ~
                <JoinDomain>1FQDN</JoinDomain>
, J: l# H" `" y; e& ?- b                <MachineObjectOU>1OULocation</MachineObjectOU>. @6 D% `, J% d& l0 x! E
                <DebugJoin>true</DebugJoin>
3 p/ w1 ~+ }& Q9 U9 v  N1 Q( k  g            </Identification>
  s: k  X5 @9 y3 l! L. _4 o. c  p        </component>
2 o1 }0 T0 g# T* W        <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">! H% X2 K- Y4 U* S
            <ComputerName>1ComputerName</ComputerName>
9 p' ?" D* R+ N$ E) u. Z            <AutoLogon>
0 V* @4 ~2 |; `7 w                <Password>
" ^& U5 V3 Y: c* q                    <Value>1AutoLogonPW</Value>
. a  @7 Y7 R% G7 H0 J( ?                    <PlainText>true</PlainText>
; P' y& Y5 k( c3 X8 ?- e' R                </Password>
- }9 e3 F# ^- [' Y, `                <Enabled>true</Enabled>
2 s! _! i' |3 @( e                <Username>1AutoLogonAcct</Username>
) e( [  x/ t6 x! N                <Domain>1Domain</Domain>. T- }& q5 |( v) Q) R
            </AutoLogon>  w9 I" q; ~  Y7 l  R7 G$ a
            <RegisteredOrganization>MyOrg</RegisteredOrganization>
3 p9 g% g. a9 e$ z" O            <RegisteredOwner>Administrator</RegisteredOwner>
- ?6 E" I5 ~" A* o1 i            <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>! z+ p2 F& e& U& ^
            <TimeZone>Central Standard Time</TimeZone>
: j# Z5 c2 X& o6 O9 y; X        </component>
4 ?' B$ \  N' [# u. q& N+ g! ^# W        <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">& D$ t% Y) R! S: k; @! P& j
            <IEHardenAdmin>false</IEHardenAdmin>- Q  V( N5 D$ w$ b4 x1 h
            <IEHardenUser>false</IEHardenUser>
  W4 B! F) w! Z& N: v! _2 \        </component>
8 S6 T1 m* r6 P  E1 l. `    </settings>
: D9 B" c( l+ m; o    <settings pass="oobeSystem">
6 c' g" L+ [" X  u6 \$ s        <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 ">) n2 {$ ]/ {5 B7 l
            <OOBE>
5 p* w- F! ^# F3 z% _0 R                <HideEULAPage>true</HideEULAPage>' f/ ]( H, {$ }! b; M2 M
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
9 d5 Q+ j8 s; H                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>5 r7 ]! H4 @6 i; p% a7 S
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>1 v* ~8 m* a2 ?
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>2 |$ t% {9 G: M5 z7 z1 u
                <NetworkLocation>Work</NetworkLocation>% r: l% O1 `6 G
                <ProtectYourPC>1</ProtectYourPC>
' s  r; T2 R9 z: j                <SkipMachineOOBE>true</SkipMachineOOBE>) S+ T  U) i4 i
                <SkipUserOOBE>true</SkipUserOOBE>
, X- y& _' a& _  R- h6 h            </OOBE>( S2 ?$ G- r( B1 x% ?2 f
            <LogonCommands>. Y* z4 r+ k9 `% B0 f; p& W1 X8 O- e
                <AsynchronousCommand>
/ k2 Y6 {1 Y: M* }                    <CommandLine>powershell -NoLogo -ExecutionPolicy Bypass -File 1DeploymentScript</CommandLine>( C6 g! M$ T* {$ \" s) R8 h
                    <Description>Installs components</Description>
$ P! D: D0 D7 e                    <Order>1</Order>4 _1 k- `, `# Y+ \# X5 }$ `. w
                </AsynchronousCommand>9 A1 W3 T5 l; M# d& L3 G
            </LogonCommands>
4 {% Y* ^4 {. q$ g2 r" P3 Z6 i2 a            <UserAccounts>. ]- M( t( U4 P. {, Z9 \* J8 d
                <AdministratorPassword>4 C8 G2 u' S0 S; D
                    <Value>1LocalAdminPW</Value>7 ~' e- Q, C8 C! L
                    <PlainText>true</PlainText>
% F0 i+ n% y6 o* L( ]% ?2 I( w                </AdministratorPassword>) k( Y5 l& W. R5 l0 Y# Z+ q
                <DomainAccounts>
, ]5 g2 `" a' L, W                    <DomainAccountList>
/ t3 C. V" K. E2 G                        <DomainAccount>0 r0 N) {( y$ n  R
                            <Group>RemoteDesktopUsers</Group>
! I, C" H/ r6 r2 g                            <Name>Domain Users</Name>
4 a* i) P" d$ |' s1 R5 A( s! [                        </DomainAccount>
2 T7 q: k2 a3 Y7 Z# d                        <Domain>1Domain</Domain>
1 X$ |5 k4 \# `. n9 L                    </DomainAccountList>
+ L4 V5 {1 q8 X5 W! o                </DomainAccounts>
% z4 d. |/ |7 U7 S            </UserAccounts>
  |' O* r7 d/ a# @, R$ Y        </component>
6 A7 k  g" i' I, a    </settings>
' Y+ ]! h, F4 a; P- k3 ~! W</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"?>
0 l, @! s: Q- a) F6 w1 u5 Y<unattend xmlns="urn:schemas-microsoft-com:unattend">
; L0 e# n# x7 h( E7 [8 ]; _9 i    <settings pass="windowsPE">
( s- F1 F) s$ d5 R# m  `8 @        <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">2 F: u  X2 y- z2 N3 r# c- y. c
            <SetupUILanguage>
2 O6 e; `+ R: |  x5 `, p. I" ?' y( o: U                <UILanguage>en-US</UILanguage>6 U1 ~) \6 O1 x1 W$ P; A
                <WillShowUI>Never</WillShowUI>. q6 ^- }- T; @1 ^9 n
            </SetupUILanguage>4 t7 u1 P6 F8 W  p/ X* }
            <InputLocale>en-US</InputLocale>9 d: P* e3 D) C$ b
            <SystemLocale>en-US</SystemLocale>
( S" Z) L) O4 y1 a3 R            <UILanguage>en-US</UILanguage>
" @, w. V# j4 @! Q, W& g            <UserLocale>en-US</UserLocale>
) C( V) \" h; }: r        </component>
9 Z% D$ }# }$ _( a/ X        <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">
# N/ C; s  b& q$ }: ?            <UserData>0 d8 s. x# G7 |7 {- V# w( i' {1 c
                <AcceptEula>true</AcceptEula>2 Z: w  h5 m+ X
                <ProductKey>) d5 u0 n6 i3 V
                    <Key>11111-22222-33333-44444-55555</Key>
& K) Y( G5 i! d* j- ^                    <WillShowUI>Never</WillShowUI>; B% P8 v' U0 ?
                </ProductKey>( J% b+ ?  e% C% `+ D0 p
            </UserData>  }/ h/ X8 p. m7 J* R
            <EnableFirewall>true</EnableFirewall>( E+ Q, P6 F4 q; n, S5 c- C& x
        </component>* t" ~  y! X8 p8 @0 {! l( G8 `
    </settings>2 P1 {8 A' h; Q4 ?3 k3 ?: l
    <settings pass="specialize">" s( Y! B# T! I2 w# o5 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">3 M6 A) x; d* g' F
            <TimeZone>Central Standard Time</TimeZone>6 X' O2 k( K7 p% O& j3 I
        </component>9 j4 B% h' ^  j' I2 j2 N
    </settings>
) _1 K" ], e. V/ U$ a8 c0 @% f    <settings pass="oobeSystem">
& H# v" a6 @" e6 T9 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">
& }8 T: x7 f+ K4 T9 b8 c7 N            <AutoLogon>! P3 m& }, Z' \
                <Password>
/ A/ W! j; g' P6 f" i+ }                    <Value>PASSWORD123!</Value>
' S: j! f6 T% u4 x( \4 {1 c                    <PlainText>true</PlainText>& G/ o" @1 l. Y, f* S5 m" {8 c
                </Password>1 |  B4 x+ d9 y1 ^- v0 E3 ?$ J5 h( e
                <LogonCount>2</LogonCount>
2 l) V2 X* A3 V2 p                <Username>Administrator</Username>
) E( ?6 }9 X) c                <Enabled>true</Enabled>1 C: B! T! i3 r$ J! m8 H. X
            </AutoLogon>
- ^) \; E- V5 r0 D            <UserAccounts>
8 @( y* w8 d* Q3 ~7 o: N- k                <AdministratorPassword>/ M3 ~  w, v: j# Q  Y. n/ m3 L
                    <Value>PASSWORD123!</Value>
- f6 b+ r7 b8 n$ p0 _& N                    <PlainText>true</PlainText>
& \, x6 j8 ]2 [8 b                </AdministratorPassword>
- b2 V4 c" y; v8 c            </UserAccounts>
+ ~5 f9 C7 x1 _        </component>" W/ e- Q- ?; j
    </settings>' L9 X& p2 |# y7 l" w. a, G
    <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" />+ o' z+ O; C- ~4 }( c
</unattend>
  J; _- I, F9 ?( E! j
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

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

GMT+8, 2026-4-10 16:22 , Processed in 0.046364 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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