找回密码
 注册
查看: 1681|回复: 6

windows 镜像制作 来自 官方文档

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2021-11-11 11:15:28 | 显示全部楼层 |阅读模式

- I  v2 a$ j& U; P) R* w" }
通过百度,google找到些资料,看到官方制作文档如下:
( D7 [) L  B$ N
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* }1 B: K- L3 A) |0 K# c
      8 n+ N4 K- w2 u; g7 m1 {- s+ G6 u

      9 y# Y4 v9 w8 S1 k. N+ y
  • 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" ^5 F3 ~1 C! k6 t# [3 ?& Z
    % Q7 A2 S2 }, h3 X/ ~5 l' p" J$ 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
    , h6 M/ k+ Q5 u3 i/ n9 r7 u8 p' t
    . t8 c8 v# I# H  Z* ?9 x# A  b! G
  • To allow the Cloudbase-Init to run scripts during an instance boot, set the PowerShell execution policy to be unrestricted:
    C:\powershellC:\Set-ExecutionPolicy Unrestricted9 {, b# w1 W5 N  O: y0 p) A& w# K
    " O( I$ J1 H' ?
  • Download and install the Cloudbase-Init:
    C:\Invoke-WebRequest -UseBasicParsing https://cloudbase.it/downloads/CloudbaseInitSetup_Stable_x64.msi -OutFile cloudbaseinit.msiC:\.\cloudbaseinit.msi
    8 h" h2 y# b8 k  x3 E1 Z
    9 ^2 ]5 x* a- E8 a; Y$ {
    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
      5 }/ P* I! `( C+ E$ A+ d
    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.

    : q8 v, S1 j* c1 _! A% @  A
Your image is ready to upload to the Image service:
$ openstack image create --disk-format qcow2 --file ws2012.qcow2 WS20125 f4 C5 T/ b: g* v5 G+ d0 n  K/ G

' t2 S3 |5 n7 x2 N2 Y! y% u

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 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! V3 i) {' {3 T( O. D& u" ^

! m/ C' o+ I- J$ _' f) H, u
8 X6 H! a% s+ K9 @  v/ @1 R1 H) E. ^

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-11-30 10:09:34 | 显示全部楼层
[DEFAULT]6 L: e; |  S9 u! c. T
# 创建什么用户以及用户属于什么组.
9 @% }' k- P7 o9 t8 nusername=Admin          #一般都是改为Administrator
7 C* A& i; X5 K. L: k4 Rgroups=Administrators
  V5 W! e# W9 V% p: {, x3 Hinject_user_password=true  # 从元数据中获取密码 (非随机).
, {" {6 ]$ L8 B  l+ c/ ]! R7 E& z# 那个设备是可能的配置驱动 (元数据).0 e( ]+ ?3 V! }& S7 k1 Q
config_drive_raw_hhd=true1 f4 m: g( ^$ J( d: G1 U
config_drive_cdrom=true  k* w2 }) h' Z' v
# 与ubuntu中功能相同的tar命令默认路径.
0 Q5 z3 @& ~+ r9 i1 H$ |bsdtar_path=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
' ~# z7 s9 ]+ A3 {. V# 日志等级.3 Z  Y+ Z' c5 R' p2 ?
verbose=true6 N: a. G2 q+ v
debug=true& t; P% W; N: Z# m2 p  B5 R4 n2 V
# 日志存放路径.' l& D' s9 B( w# K* m$ B5 V
logdir=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\log\
+ a$ q9 f; H/ B2 slogfile=cloudbase-init-unattend.log% W" d. b4 x# [( d$ B
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN
" a- u$ W7 |+ A# V0 e# c' Mlogging_serial_port_settings=( d& r* r! r# c& t# }' N8 g
# 启用最大传输单元和时间同步服务.1 x& J% e4 S* A$ k0 }
mtu_use_dhcp_config=true- x- ~  f/ L4 {3 @
ntp_use_dhcp_config=true7 K2 y% _0 ^7 X. Y+ u
# 存放用户用于执行的脚本的路径.
( n7 Z* O. H' c, tlocal_scripts_path=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\LocalScripts\) I7 u! z; `2 k
# 服务将会检测以下驱动直到某个能够成功获取元数据., N# j: c4 C" }. I6 N6 N" U
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService, #可以开启ConfigDrive和httpservice(Openstack)
% H' J1 @: P0 W8 C                  cloudbaseinit.metadata.services.httpservice.HttpService,
- t3 e/ u$ |) T" d; g! m                  cloudbaseinit.metadata.services.ec2service.EC2Service,4 H# N0 W# e- Z# k' q
                  cloudbaseinit.metadata.services.maasservice.MaaSHttpService
$ ~  m4 c$ W  c5 q' e6 I) y# 需要执行的插件.
& g# {. P' |$ V" gplugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,
" t. K' @8 t! K9 j9 Z# z        cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,
# n! n9 _0 H' O( q( R+ c        cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,
$ d1 Q1 |2 f9 A; k        cloudbaseinit.plugins.windows.userdata.UserDataPlugin,
. S8 \& w8 r1 y, p. Y8 P+ k        cloudbaseinit.plugins.windows.setuserpassword.SetUserPasswordPlugin,9 B  ~+ i% E0 ]% p) P: P: i; `
        cloudbaseinit.plugins.windows.localscripts.LocalScriptsPlugin
; H4 N4 C6 M( P4 k# 其他配置.
+ o3 @9 B% ?3 ^& _- D0 Sallow_reboot=false    # allow the service to reboot the system7 G' B) L; N  L
stop_service_on_exit=false/ k8 h6 M. M. a+ z3 c3 X( S8 e

9 ^3 [0 }% {- |  u3 Z6 U/ C. c4 X
7 ]1 Y* J8 L! l$ J7 [

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-11-30 10:20:11 | 显示全部楼层
<?xml version="1.0" encoding="utf-8"?>
* D) ?% W7 r& O1 ^<unattend xmlns="urn:schemas-microsoft-com:unattend">
* N% y& w2 y" d6 c<settings pass="oobeSystem">
0 a4 h% }' f# i) T<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">5 W. [+ J  F% `
<InputLocale>zh-CN</InputLocale>
5 f( D8 s! G% P, A3 ?7 M% h<SystemLocale>zh-CN</SystemLocale>) }' O* T6 k3 w. Q- e
<UILanguage>zh-CN</UILanguage>8 `2 f  W9 w8 e' w! g6 }
<UILanguageFallback>zh-CN</UILanguageFallback>2 D. Q$ y3 s  r
<UserLocale>zh-CN</UserLocale>. ~: ^  H- s) u( l0 M
</component>
& y1 D9 W# ?# d( j<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">5 b; v+ x" }3 `, f5 _1 q
<AutoLogon>
0 E* T0 y0 q+ z+ l# O1 s# g2 P<Password>
( `2 f3 N! i' G1 f' K<PlainText>false</PlainText>" R$ @: a) B1 @1 Y2 j: |6 ^
<Value>YgBvAGMALgAxADIAMwBQAGEAcwBzAHcAbwByAGQA</Value>9 o# {1 C7 F- m# |" \1 Q
</Password>
9 ~+ l# W9 Z4 }, I& E<Enabled>true</Enabled>' e; I2 d/ }% e
<LogonCount>1</LogonCount>
" Z/ U) _- Q1 e) n<Username>administrator</Username>% Y0 t& U: o  `+ z+ R% Z
</AutoLogon>0 m/ I" M0 N0 j
<OOBE>
( f% \4 S" I' r" \, e- R) C<SkipMachineOOBE>true</SkipMachineOOBE>
; R4 f8 Z, X- o+ T: V</OOBE>
8 _: p8 S: o: ?) {' u<UserAccounts>) L/ g6 T2 B/ [5 r
<AdministratorPassword>
/ a: p" v4 m1 H' L; t<Value>YgBvAGMALgAxADIAMwBBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByAFAAYQBzAHMAdwBvAHIAZAA=</Value>
" |3 h/ D4 E3 R( f- p! n! r<PlainText>false</PlainText>' {/ n$ K+ p+ t$ J% w' E0 f6 @8 ]- N- u
</AdministratorPassword>" I( [* w& p$ t2 a8 ]
</UserAccounts>1 l) t* p) s  H3 s$ Y8 q# n1 B
<FirstLogonCommands>
: H; x+ `. t3 ~  C$ D<SynchronousCommand wcm:action="add">
. M, H, Y5 F0 \: t# j' @<Order>1</Order>
2 f9 W: S0 w* Q/ ^' J/ T4 l<CommandLine>%WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe c:\m.ps1</CommandLine>
* k& L" r8 H, k# D</SynchronousCommand>
* L3 h" ?. m5 a0 C7 K; q</FirstLogonCommands>: I, ?( i2 o0 ~: d: O
</component>. B) Z7 [( j6 c/ N, M) n- o
</settings>
' ~  X2 X7 w+ S<settings pass="specialize">6 Y; q1 Q. }9 Q! N8 l
<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">
1 N3 I4 W8 G" w. c- A& j7 Q<SkipAutoActivation>true</SkipAutoActivation>
3 _7 i$ N7 D" G: \</component>
# _$ j) a4 `. R) o<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">: d1 [4 M  D2 q+ V# {* W9 \+ j, C
<ComputerName>PCname1</ComputerName>
) x# }. p7 c- |6 o<TimeZone>China Standard Time</TimeZone>0 s" G$ L# N9 `! ^, N
</component>
+ G$ q) w! ]/ P. V7 V4 d</settings>
6 B$ D! H6 t6 @% ~- ~. X<cpi:offlineImage cpi:source="catalog:e:/isotest/win2008r2_en_windows server 2008 r2 serverenterprise.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
% L: e# N" }1 A& G- u2 [</unattend>
1 I/ P0 |6 d8 U0 l6 W

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-11-30 10:21:18 | 显示全部楼层
<?xml version="1.0" encoding="utf-8"?>
, N  R! w# ]" ^& l7 S<unattend xmlns="urn:schemas-microsoft-com:unattend">$ [! A" q0 [. o
    <settings pass="windowsPE">
! ^% [& X$ f' z/ P        <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 n! ^2 W, `* F, h6 ]/ N8 N            <SetupUILanguage>! p. o8 [& w+ B6 f
                <UILanguage>en-US</UILanguage>! R! f& D4 r& p# T6 D7 p
            </SetupUILanguage>$ ~) E- j' e, w/ P4 W0 Q
            <InputLocale>en-US</InputLocale>: p! t6 ^/ V+ S1 x4 m5 {; d
            <SystemLocale>en-US</SystemLocale>& j( X: |, a. L+ X/ {
            <UILanguage>en-US</UILanguage>' H5 X: j0 Q* u- Z6 B
            <UILanguageFallback>en-US</UILanguageFallback>
8 T9 m. V2 n- ]  x6 F9 m+ q# q            <UserLocale>en-US</UserLocale>: o. v" F+ Q) Z: _5 w) @; o0 v8 |
        </component>5 Z" |5 k% ?: t, |2 ?
        <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">
/ C) |! Y( T0 H6 _1 f            <ImageInstall>
1 V, w! G* t  K+ {8 J3 J                <OSImage>1 s5 D* A+ T4 E) b" I% Q/ d8 E+ j0 [
                    <InstallTo>: E% w! A% Y) _- l* c- w, i
                        <DiskID>0</DiskID>8 r9 P7 q& b  S5 \: S  a* l8 W0 ~3 W9 k
                        <PartitionID>2</PartitionID>
/ Z( Q1 D! J  V( _/ `                    </InstallTo>. E- ?) Y! R- f3 Z; \9 g: j% T
            <InstallFrom>* `* n) S; j$ Y- @$ v! R9 H- t* z& Q
            <MetaData>
% R4 H0 G: F6 }, v, n' l                <Key>/image/name</Key>) F8 q! e9 E0 X
                <Value>Windows 10 Enterprise</Value>! G$ U, O% O  M* K; G' _
            </MetaData>1 [2 _9 Y. a5 e9 J
            </InstallFrom>            
) ?+ Z& p- L3 v4 G. O7 b# A/ e                    <InstallToAvailablePartition>false</InstallToAvailablePartition>! U  S. g" u! Y
                    <Compact>false</Compact>5 Y5 ~. m3 T- b. G4 ]* J, S
                </OSImage>! w& Y' k- `; E% [! S6 F
            </ImageInstall>* t; e$ h5 D: \9 L  b) }2 ~# l; M
            <UserData>
0 O+ ?( G+ v, T$ N# p                <AcceptEula>true</AcceptEula>! q, q- e# u0 B0 f! W% S, _
                <FullName>Administrator</FullName>  t/ x  l) K1 _$ C$ Y" s1 h
                <Organization>MyOrg</Organization>! s* g9 N  a+ y& c0 C
                <ProductKey>  }+ L9 J  d1 A$ h
                    <Key>1ProductKey</Key>
) A4 m1 N  r& D7 P                </ProductKey>, u( r2 K2 Y% N
            </UserData>- m: K* F( d" E! c" M$ n
            <EnableFirewall>true</EnableFirewall>
4 A  x2 r& x9 }' l0 r: P0 l* t            <DiskConfiguration>* Y, q2 n* K" T& b
                <Disk>
2 e! y. ?3 [4 i8 V) D8 R+ b                    <CreatePartitions>' V! C& w* m+ u% g
                        <CreatePartition>
1 u5 |% A& p: p& j9 O% v1 w                            <Size>500</Size>
1 O; F; m/ q: F* ~8 r1 q7 b3 Y' `                            <Order>1</Order>6 `; x2 v* B7 T2 q; c. i5 c
                            <Type>Primary</Type>5 [5 \! _8 q) P' L3 w4 ]  O
                        </CreatePartition>
, G( P' ]9 b  m1 t                        <CreatePartition>
% V' O& j( r8 q! e" |' A                            <Order>2</Order>  N9 {! o8 n! n' C1 [% D
                            <Extend>true</Extend>) |/ `, I* D6 ~; X
                            <Type>Primary</Type>& g2 F2 P5 m( n7 R
                        </CreatePartition>. h$ P. Y+ G3 v+ Q# U1 n( Z& @: J% s
                    </CreatePartitions>; b$ i$ h$ H4 e! x1 L
                    <ModifyPartitions>
2 B; E7 [3 s1 t1 O8 c7 s                        <ModifyPartition>
" |' A9 \4 k7 h! @2 V                            <Active>true</Active>* P# U8 M* b' v0 a
                            <Extend>false</Extend>
1 D* ?" X5 p' A5 T( {: _/ t                            <Format>NTFS</Format>& a; @2 t9 D9 \- |
                            <Label>System</Label>/ v. E) Q4 j# _9 F  N
                            <Order>1</Order>2 X2 m. o5 C! j
                            <PartitionID>1</PartitionID>, ~) T0 i! H7 E" r3 Y) T0 ~7 ^
                        </ModifyPartition>
! a0 T* p* L4 ]2 k/ k& ?* ~                        <ModifyPartition>
+ n9 f8 N0 P, \' _$ _                            <Active>false</Active>+ ^& X2 i9 f$ {( C% }
                            <Extend>false</Extend>) a! g2 y" `" Y5 J# s  d
                            <Format>NTFS</Format>! o2 [/ E8 s  e6 C! g
                            <Label>OS</Label>
7 D) ]7 n. B; H& t% f% n: h- ^7 z                            <Letter>C</Letter>
9 L. n. }" l. ^# b$ R. H  n                            <Order>2</Order>* T- b) j) z9 y
                            <PartitionID>2</PartitionID>) d& g- i9 m  ?- W2 _1 @( |0 z
                        </ModifyPartition>1 f' t4 S* i; ]! E; z$ b
                    </ModifyPartitions>5 f& U9 c- ^$ n! ]+ v
                    <DiskID>0</DiskID>
0 M0 n. _$ g' ^* m) R/ Z                    <WillWipeDisk>true</WillWipeDisk>
! Q' y; \5 J3 k" r: ]# u/ D9 k                </Disk>3 H5 y  }. U& H  V2 G: A
                <WillShowUI>OnError</WillShowUI>; W3 J5 Q/ ?7 [+ q7 k% R9 E9 A3 x
            </DiskConfiguration>' a$ @( i7 y! M2 C5 h8 `' c
        </component>
- {6 R3 H2 D9 ?) Q7 T    </settings>8 G; y" V# ^* g: a
    <settings pass="offlineServicing">( T  `4 O- L% r3 C) ?2 J
        <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"># N8 v0 L# C5 _# u; ^
            <EnableLUA>false</EnableLUA>
  x- s. v! |" y2 y8 W        </component>5 i3 j$ l: I! W! B* i
    </settings>
$ Q/ p2 C% D. ?3 B: J" e    <settings pass="generalize">* b( c$ k6 f# K9 H0 k" T
        <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">3 J9 j4 \5 z5 m% @9 F, K
            <SkipRearm>1</SkipRearm>* v" l. @% @* l6 _8 U
        </component>
# L! g( _* C9 S2 b% ]    </settings>
! n( ?+ e% z$ x" y1 C  S    <settings pass="specialize">
% Z) d3 f' S5 n# u7 ^) a& P        <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">4 Q( c  l) _$ _# ]( W* v1 ?0 ^
            <Identification>& a# h  X& N) Z3 o, @3 i8 A
                <Credentials>
* X! X7 f  R: g) g" r/ ~                    <Domain>1Domain</Domain>
( m- f5 y  e# L; G                    <Password>1DomainJoinPW</Password>
) i7 ?! `0 T: }% a/ T                    <Username>1DomainJoinAcct</Username>2 d% j) e6 q0 b) a7 D8 }
                </Credentials>! F) j5 f# k. D0 W* g4 o
                <JoinDomain>1FQDN</JoinDomain>
, _( w+ T. }4 x/ C( k7 z( k                <MachineObjectOU>1OULocation</MachineObjectOU>+ ?3 S/ z9 X9 v8 x
                <DebugJoin>true</DebugJoin>% N8 P4 e" U5 U* I5 n  U
            </Identification>
; p+ D$ R- j. l4 a. u9 x# M        </component>0 b9 F8 `' O/ c% K! 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">; M7 A5 a4 J, H; G
            <ComputerName>1ComputerName</ComputerName>
7 }  ^6 [9 J" X$ i: w            <AutoLogon>
+ M7 U$ D/ q6 u0 L8 t2 |                <Password>
# `3 ]4 F' j) H3 c+ W                    <Value>1AutoLogonPW</Value># \, }" ?) Y1 s
                    <PlainText>true</PlainText>- K- L: b" b; _! O/ r) E; P1 A
                </Password>
) L4 T; T# g; M& g, y: S: u                <Enabled>true</Enabled>
( P5 [8 \. ?& t5 u, h! W7 J; \                <Username>1AutoLogonAcct</Username>
5 d% k7 u0 K1 K                <Domain>1Domain</Domain>
0 \" C/ v. E+ D8 K            </AutoLogon>% P: P, _0 Q/ }  Z' }
            <RegisteredOrganization>MyOrg</RegisteredOrganization>
: n; \, Z9 j2 ?+ I- L            <RegisteredOwner>Administrator</RegisteredOwner># z; ?: R3 M3 W) A" q( W$ u1 s
            <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
, ?6 L' b  ?! T" S5 S            <TimeZone>Central Standard Time</TimeZone>
$ }5 G8 |2 }* f* N5 c9 @+ i        </component>
2 }, e! F) p# N) t+ M3 A- V) l        <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">
1 y+ h2 o/ @3 K$ d7 p; j( N7 N8 |; \            <IEHardenAdmin>false</IEHardenAdmin>: {  F6 S! |3 j2 t, B
            <IEHardenUser>false</IEHardenUser>8 [" ?" m( _; u, c# _- F3 |+ `
        </component>, I9 |& ^% p2 c/ R) l
    </settings>
2 ]- x7 T" A* v/ i    <settings pass="oobeSystem"># Y1 j% H" k1 C! E
        <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 ">( h9 z: ?2 V# @4 M3 _' |8 X% z
            <OOBE>0 m# g! d8 @( N5 I/ y" y& U
                <HideEULAPage>true</HideEULAPage>
9 C3 M+ P% H2 Z* I% e1 F                <HideLocalAccountScreen>true</HideLocalAccountScreen># f2 z5 U( {# ?* c7 b/ f. X) V' C
                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
, B2 }5 G% q" O1 S; d' {, c0 m' U                <HideOnlineAccountScreens>true</HideOnlineAccountScreens># y8 g6 u: ~9 d$ R, T7 [- p) T
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
5 u, B* p, Y% m9 l                <NetworkLocation>Work</NetworkLocation>
1 W1 N5 I2 A5 `0 _4 A6 r6 }+ M4 `% b                <ProtectYourPC>1</ProtectYourPC>
: ^: i9 E& D" S6 K$ d! ^- m+ @( D                <SkipMachineOOBE>true</SkipMachineOOBE>
1 m4 p. N: z7 \8 l& |" M9 ?                <SkipUserOOBE>true</SkipUserOOBE>; I3 X7 j1 A: R
            </OOBE>
1 X2 N. y! V0 Q# C+ a            <LogonCommands>+ e& k% v# B+ n; D+ o. W
                <AsynchronousCommand>
2 f8 u4 U: v5 |" u/ j0 B8 ~) e$ P                    <CommandLine>powershell -NoLogo -ExecutionPolicy Bypass -File 1DeploymentScript</CommandLine>+ r# N, E$ m' x) V5 y" V% L5 S
                    <Description>Installs components</Description>
) B' J9 ~. q6 F' K% t! D# t                    <Order>1</Order>8 ^9 e; o* e! r1 Q, y
                </AsynchronousCommand>' o: @% C9 L+ `: O
            </LogonCommands>( ~# g5 ]- u* n) F: f; K  [
            <UserAccounts>
1 S4 g4 L0 U4 k0 C7 G                <AdministratorPassword>
5 e# k" s5 g' W* v, c  g" _                    <Value>1LocalAdminPW</Value>5 O2 y" P( A: [: s( `, ], P
                    <PlainText>true</PlainText>. Z: S. U% R) h2 z: T, T; b8 e
                </AdministratorPassword>9 P2 \$ v# i: S- d( u, j
                <DomainAccounts>+ ^0 U2 B3 _7 Q/ i9 H
                    <DomainAccountList>2 l( @9 F7 g( O. N. g( d
                        <DomainAccount>
3 j% l+ \6 e& k+ l- C                            <Group>RemoteDesktopUsers</Group>
6 a: U8 k- p" Y( K) B0 R; P                            <Name>Domain Users</Name>
4 `5 F4 Z8 w3 W* Q, H                        </DomainAccount>
. P8 x* a; T! [& E# }" H                        <Domain>1Domain</Domain>8 C0 i' ^+ z. T3 I
                    </DomainAccountList>
0 u9 F0 ]& l& H# m                </DomainAccounts>
, A( v, y! b& W            </UserAccounts>
& j& T# Y9 |* j, k8 L) c$ z) f/ V$ j        </component>
0 G! `% Z) Y9 B    </settings>
% F4 n2 |) C. s- A( B$ a9 E</unattend>

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-11-30 10:22:38 | 显示全部楼层
执行命令”C:\Windows\System32\sysprep\sysprep.exe /generalize /oobe /unattend:Unattend.xml”,对Windows系统进行封装。执行完该命令后,云服务器会自动关机。

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 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"?>" m, R' N4 \. e) }+ D3 g' n
<unattend xmlns="urn:schemas-microsoft-com:unattend">; P. s/ @! a; h9 W1 i) Z: p# C
    <settings pass="windowsPE">3 z: \/ l  g( m* N6 C( R
        <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">
+ ?4 ^/ j6 S* O- d, u7 o            <SetupUILanguage>
& B  r6 o% Z9 y6 W: e: H$ _                <UILanguage>en-US</UILanguage>6 v! y; T3 C8 [" f: V- c: P
                <WillShowUI>Never</WillShowUI>
- G; l  M# s" ^  [9 ^9 d% i4 o/ l            </SetupUILanguage>
% O( P: K* b+ ^- A- r            <InputLocale>en-US</InputLocale>
- J# `! x7 t9 n; a            <SystemLocale>en-US</SystemLocale>
( H) o$ }: ^# A; t8 m' o* A2 ~' H            <UILanguage>en-US</UILanguage>
. n  m8 G- p% g, K3 B" ?            <UserLocale>en-US</UserLocale>
  B+ [9 ]; Q0 v" z6 O8 q        </component>0 N- W# V7 w! ?: X4 `+ ~. X5 n! y
        <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">
; u( d# \9 l) e% b            <UserData>6 N) U; F+ m" F/ @9 F: \
                <AcceptEula>true</AcceptEula>
  `) I! L! ]( o                <ProductKey>, y- L  U. b6 }9 g: _
                    <Key>11111-22222-33333-44444-55555</Key>; I  @# `' E& X/ N$ t
                    <WillShowUI>Never</WillShowUI>
/ x% E7 I4 ^- |8 E                </ProductKey>
1 \2 f2 c5 @6 j2 C# A" v- a            </UserData>
% o( h; I% G* B5 G: t            <EnableFirewall>true</EnableFirewall>
( }+ L& }! v( V7 E8 O$ v' w        </component>6 }: z; r. s5 d+ G
    </settings>
/ M: B& h& J. b% t3 c: x0 h$ ?/ W    <settings pass="specialize">
3 l8 ^% ?. l$ e4 z7 k, Z        <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"># l2 e. s3 k$ S: \- A. V2 e
            <TimeZone>Central Standard Time</TimeZone>  s: A5 F9 o8 [/ B* q3 N) ?& w: b
        </component>
( P/ p/ [5 V' B, y; ~    </settings>! n) ?2 b) l. l, `; f- x$ W3 I
    <settings pass="oobeSystem">
8 b, H. w0 C. |8 M% 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">" H. a" p* t8 L/ Z) ^, B6 s, k
            <AutoLogon>
; E; S- M% N& p8 S# Y- g" R                <Password>
1 m/ d: i6 c' x8 ~/ d% H                    <Value>PASSWORD123!</Value>
5 R2 w- J! k* p. L  P! o( ]                    <PlainText>true</PlainText>
5 ]+ s0 z( }8 A- d! `9 R0 h/ Z2 {                </Password>
2 d; w2 [  n$ P+ ^                <LogonCount>2</LogonCount>
4 r% F( @0 D: L! m% B                <Username>Administrator</Username>
' `  J; p& A& z( Z+ x                <Enabled>true</Enabled>
( `0 D4 @9 O+ B            </AutoLogon>
0 B$ v+ R9 a! c. N            <UserAccounts>
/ V. M! |& T2 |' B+ o$ M# H# L, ~5 l                <AdministratorPassword>
  T) c( [8 M% b% m) p- H                    <Value>PASSWORD123!</Value>& L+ ~3 \* p6 q. t+ R
                    <PlainText>true</PlainText># F$ l. Y1 Y# w; `4 g3 Z* {
                </AdministratorPassword>
' S" b: V0 s9 ~5 w            </UserAccounts>: y$ G: `$ D+ }
        </component>
7 [' U/ h) d) j2 d( ?    </settings>
# r( t, W9 {/ Z    <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" />' w3 _" [  C4 z2 }; ^
</unattend>
% U- M: Y8 ^. v3 Q' ~6 b
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 02:01 , Processed in 0.025155 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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