我知道這是一個很古老的問題。然而,當我遇到類似的問題時,谷歌引導了我這個問題。我做了以下解決我的問題。
名爲Microsoft-Windows-Shell-Setup
component
節點。
<AutoLogon>
<Password>
<Value>NewUser'sPassword</Value>
<PlainText>true</PlainText>
</Password>
<Username>NewUser'sName</Username>
<Enabled>true</Enabled>
<LogonCount>999</LogonCount>
</AutoLogon>
生成的文件應該看起來像下面的代碼片段。我刪除了不需要這個答案的部分。
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="oobeSystem">
<!-- snip -->
<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">
<!-- snip -->
<AutoLogon>
<Password>
<Value>NewUser'sPassword</Value>
<PlainText>true</PlainText>
</Password>
<Username>NewUser'sName</Username>
<Enabled>true</Enabled>
<LogonCount>999</LogonCount>
</AutoLogon>
</component>
</settings>
<!-- snip -->
</unattend>
。現在
powershell.exe -command { Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\winlogon" -Name AutoLogonCount -Force -ErrorAction 0 }
- 我們就可以開始Sysprep的。使用UI或以下命令。
。
%ProgramFiles%\Amazon\Ec2ConfigService\ec2config.exe -sysprep
使用上述實例創建的AMI啓動的任何實例都將無限期地保留自動登錄行爲。