在安装系统上踩了好多坑,像什么账户密码过期、脚本运行失败什么的,现在把我自己改的一些稳定的脚本分享出来
一、安装路径
无人值守脚本放置在C:\Windows\Panther\unattend.xml这里
二、脚本示例
Windows10-11简体通用脚本 创建自定义账户
该脚本特点:适用于简体版本、创建管理员账户Admin、不设置密码且账户密码永不过期、自动登录、强制过联网检测
说明:如果要修改账户名请把全文里的admin改成你要自定义的账户
注:把下面的代码保存成unattend.xml文件放到上面的安装路径里
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- ====== specialize:提前锁定地区/输入法 ====== -->
<settings pass="specialize">
<component name="Microsoft-Windows-International-Core"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<InputLocale>zh-CN</InputLocale>
<SystemLocale>zh-CN</SystemLocale>
<UILanguage>zh-CN</UILanguage>
<UserLocale>zh-CN</UserLocale>
</component>
</settings>
<!-- ====== oobeSystem ====== -->
<settings pass="oobeSystem">
<component name="Microsoft-Windows-International-Core"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<!-- 再兜底一次 -->
<InputLocale>zh-CN</InputLocale>
<SystemLocale>zh-CN</SystemLocale>
<UILanguage>zh-CN</UILanguage>
<UserLocale>zh-CN</UserLocale>
</component>
<component name="Microsoft-Windows-Shell-Setup"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<OOBE>
<HideEULAPage>true</HideEULAPage>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>3</ProtectYourPC>
<SkipMachineOOBE>true</SkipMachineOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
</OOBE>
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Name>Admin</Name>
<Group>Administrators</Group>
<Password>
<Value></Value>
<PlainText>true</PlainText>
</Password>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<AutoLogon>
<Username>Admin</Username>
<Enabled>true</Enabled>
<LogonCount>999</LogonCount>
<Password>
<Value></Value>
<PlainText>true</PlainText>
</Password>
</AutoLogon>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<CommandLine>
cmd /c reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE /v SkipMachineOOBE /t REG_DWORD /d 1 /f
</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>2</Order>
<CommandLine>
cmd /c reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE /v SkipUserOOBE /t REG_DWORD /d 1 /f
</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%WinDir%\System32\wbem\wmic.exe UserAccount Where Name="Admin" Set PasswordExpires="false"</CommandLine>
<Order>3</Order>
</SynchronousCommand>
</FirstLogonCommands>
<TimeZone>China Standard Time</TimeZone>
<RegisteredOwner>Admin</RegisteredOwner>
</component>
</settings>
</unattend>
如果想要自己添加密码请在这里修改 一共有两处需要修改的地方
<Password>
<Value></Value> //在这里添加你的密码
<PlainText>true</PlainText>
</Password>
Windows10-11繁体通用脚本 创建自定义账户
该脚本特点:适用于繁体版本、创建管理员账户Admin、不设置密码且账户密码永不过期、自动登录、强制过联网检测
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- ====== specialize:提前锁定地区/输入法 ====== -->
<settings pass="specialize">
<component name="Microsoft-Windows-International-Core"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<InputLocale>0404:00000404</InputLocale>
<SystemLocale>zh-TW</SystemLocale>
<UILanguage>zh-TW</UILanguage>
<UserLocale>zh-TW</UserLocale>
</component>
</settings>
<!-- ====== oobeSystem ====== -->
<settings pass="oobeSystem">
<component name="Microsoft-Windows-International-Core"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<!-- 再兜底一次 -->
<InputLocale>0404:00000404</InputLocale>
<SystemLocale>zh-TW</SystemLocale>
<UILanguage>zh-TW</UILanguage>
<UserLocale>zh-TW</UserLocale>
</component>
<component name="Microsoft-Windows-Shell-Setup"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<OOBE>
<HideEULAPage>true</HideEULAPage>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>3</ProtectYourPC>
<SkipMachineOOBE>true</SkipMachineOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
</OOBE>
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Name>Admin</Name>
<Group>Administrators</Group>
<Password>
<Value></Value>
<PlainText>true</PlainText>
</Password>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<AutoLogon>
<Username>Admin</Username>
<Enabled>true</Enabled>
<LogonCount>999</LogonCount>
<Password>
<Value></Value>
<PlainText>true</PlainText>
</Password>
</AutoLogon>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<CommandLine>
cmd /c reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE /v SkipMachineOOBE /t REG_DWORD /d 1 /f
</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>2</Order>
<CommandLine>
cmd /c reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE /v SkipUserOOBE /t REG_DWORD /d 1 /f
</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%WinDir%\System32\wbem\wmic.exe UserAccount Where Name="Admin" Set PasswordExpires="false"</CommandLine>
<Order>3</Order>
</SynchronousCommand>
</FirstLogonCommands>
<TimeZone>China Standard Time</TimeZone>
<RegisteredOwner>Admin</RegisteredOwner>
</component>
</settings>
</unattend>
Windows10-11简体通用脚本 创建本地管理员账户
该脚本特点:适用于简体版本、启用管理员账户Administrator、不设置密码且账户密码永不过期、自动登录、强制过联网检测
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- ====== specialize:提前锁定地区/输入法 ====== -->
<settings pass="specialize">
<component name="Microsoft-Windows-International-Core"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<InputLocale>zh-CN</InputLocale>
<SystemLocale>zh-CN</SystemLocale>
<UILanguage>zh-CN</UILanguage>
<UserLocale>zh-CN</UserLocale>
</component>
</settings>
<!-- ====== oobeSystem ====== -->
<settings pass="oobeSystem">
<component name="Microsoft-Windows-International-Core"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<!-- 再兜底一次 -->
<InputLocale>zh-CN</InputLocale>
<SystemLocale>zh-CN</SystemLocale>
<UILanguage>zh-CN</UILanguage>
<UserLocale>zh-CN</UserLocale>
</component>
<component name="Microsoft-Windows-Shell-Setup"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<OOBE>
<HideEULAPage>true</HideEULAPage>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>3</ProtectYourPC>
<SkipMachineOOBE>true</SkipMachineOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
</OOBE>
<!-- 移除自定义Admin本地账户配置 -->
<!-- 启用内置管理员账户 + 自动登录配置 -->
<AutoLogon>
<Username>Administrator</Username> <!-- 内置管理员账户固定名称 -->
<Enabled>true</Enabled>
<LogonCount>999</LogonCount>
<Password>
<Value></Value> <!-- 如需设置密码,在此填写明文,PlainText=true时生效 -->
<PlainText>true</PlainText>
</Password>
</AutoLogon>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<CommandLine>
cmd /c reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE /v SkipMachineOOBE /t REG_DWORD /d 1 /f
</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>2</Order>
<CommandLine>
cmd /c reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE /v SkipUserOOBE /t REG_DWORD /d 1 /f
</CommandLine>
</SynchronousCommand>
<!-- 启用内置管理员账户(默认禁用) + 取消密码过期 -->
<SynchronousCommand wcm:action="add">
<Order>3</Order>
<CommandLine>
cmd /c net user Administrator /active:yes
</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>4</Order>
<CommandLine>
%WinDir%\System32\wbem\wmic.exe UserAccount Where Name="Administrator" Set PasswordExpires="false"
</CommandLine>
</SynchronousCommand>
</FirstLogonCommands>
<TimeZone>China Standard Time</TimeZone>
<RegisteredOwner>Administrator</RegisteredOwner>
</component>
<!-- 额外添加:禁用UAC(内置管理员默认受UAC限制,可选) -->
</settings>
</unattend>
如果要不自动登录把下面代码中的999改成1
<AutoLogon>
<Username>Administrator</Username> <!-- 内置管理员账户固定名称 -->
<Enabled>true</Enabled>
<LogonCount>999</LogonCount>
<Password>
<Value></Value> <!-- 如需设置密码,在此填写明文,PlainText=true时生效 -->
<PlainText>true</PlainText>
</Password>
</AutoLogon>

2206

被折叠的 条评论
为什么被折叠?



