前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >通用2008R2-2025的sysprep自动应答文件

通用2008R2-2025的sysprep自动应答文件

原创
作者头像
Windows技术交流
修改2024-12-02 20:36:44
修改2024-12-02 20:36:44
680
举报
文章被收录于专栏:Windows技术交流

基于cloudbase-init自带的应答文件改造:

初始密码指定在Unattend.xml中了,跟控制台三选一无关,选哪个都是自动应答文件中指定的密码,等初始化好后,你可以重置密码。

注意事项:如果基于Packer打镜像,自己准备的Unattend.xml最好覆盖“C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\Unattend.xml”

通用2008R2-2025的sysprep自动应答文件如下

Unattend.xml.zip
代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
  <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>

<settings pass="specialize">
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<RegisteredOrganization>Tencent</RegisteredOrganization>
<RegisteredOwner>QCloud</RegisteredOwner>
<ShowWindowsLive>false</ShowWindowsLive>
</component>

<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<RunSynchronous>


<RunSynchronousCommand wcm:action="add">
	<Order>1</Order>
	<Path>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f</Path>
	<Description>Hide Network Location Wizard</Description>
	<WillReboot>Never</WillReboot>
</RunSynchronousCommand>

<RunSynchronousCommand wcm:action="add">
	<Order>2</Order>
	<Path>reg add "HKLM\Software\Microsoft\ServerManager" /v "DoNotOpenServerManagerAtLogon" /d 1 /t REG_DWORD /f</Path>
	<Description>DoNotOpenServerManagerAtLogon</Description>
	<WillReboot>Never</WillReboot>
</RunSynchronousCommand>

<RunSynchronousCommand wcm:action="add">
	<Order>3</Order>
	<Path>reg add "HKLM\SOFTWARE\Microsoft\ServerManager\Oobe" /v "DoNotOpenInitialConfigurationTasksAtLogon" /d 1 /t REG_DWORD /f</Path>
	<Description>DoNotOpenInitialConfigurationTasksAtLogon</Description>
	<WillReboot>Never</WillReboot>
</RunSynchronousCommand>

<RunSynchronousCommand wcm:action="add">
	<Order>4</Order>
	<Path>cmd.exe /c ""C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\cloudbase-init.exe" --config-file "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init-unattend.conf" &amp;&amp; exit 1 || exit 2"</Path>
	<Description>Run Cloudbase-Init to set the hostname</Description>
	<WillReboot>Always</WillReboot>
</RunSynchronousCommand>



</RunSynchronous>
</component>
</settings>

<settings pass="oobeSystem">

<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">

<UserAccounts>
<AdministratorPassword>
<Value>QYv_lr6dx6cj</Value>
<PlainText>true</PlainText>
</AdministratorPassword>
</UserAccounts>

<OOBE>
<HideEULAPage>true</HideEULAPage>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>1</ProtectYourPC>
<SkipMachineOOBE>true</SkipMachineOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
</OOBE>


<AutoLogon>
<Password>
<Value>QYv_lr6dx6cj</Value>
<PlainText>true</PlainText>
</Password>
<Username>Administrator</Username>
<Enabled>true</Enabled>
<LogonCount>1</LogonCount>
</AutoLogon>

<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<CommandLine>reg add "HKEY_CURRENT_USER\Control Panel\Mouse" /v "MouseSpeed" /t REG_DWORD /d 0 /f</CommandLine>
<Description>MouseSpeed</Description>
</SynchronousCommand>

<SynchronousCommand wcm:action="add">
<Order>2</Order>
<CommandLine>reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowSecondsInSystemClock" /t REG_DWORD /d 1 /f</CommandLine>
<Description>ShowSecondsInSystemClock</Description>
</SynchronousCommand>

<SynchronousCommand wcm:action="add">
<Order>3</Order>
<CommandLine>reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v "SaveZoneInformation" /t REG_DWORD /d 1 /f</CommandLine>
<Description>download_nolock</Description>
</SynchronousCommand>


</FirstLogonCommands>
</component>

</settings>

</unattend>

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档