Hyper-V虚拟机中Windows 10自动登录的PowerShell配置难题求助
Hyper-V虚拟机中Windows 10自动登录的PowerShell配置难题求助
我在全新安装的Windows 10主机上搭建了Hyper-V,里面是一个干净的Windows 10虚拟机,这段时间一直尝试用PowerShell配置它实现自动登录。前后折腾了3周多,查了几十篇资料,但完全没效果——执行完下面的脚本后,虚拟机重启还是停在登录界面,必须手动输入密码。有没有大佬能教教我怎么解决这个问题?
补充说明:之前有管理员关闭了我的提问,理由是“已有相关答案”,比如:
Change user for automatic login (2 answers)
How do I change automatic logon via Script or Command Line? (3 answers)
但这根本不符合我的情况!我的问题是针对Hyper-V的特定场景,不管是问题正文还是标题都明确说明了,那些链接里的内容完全覆盖不了我的需求。
我尝试的PowerShell脚本如下:
$username = "User1" $password = "password" # Set registry keys for auto logon New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "AutoAdminLogon" -Value "1" -PropertyType String -Force New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value $username -PropertyType String -Force New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultPassword" -Value $password -PropertyType String -Force New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "ForceAutoLogon" -Value "1" -PropertyType String -Force
更新:我终于找到解决方案了!问题出在Hyper-V的增强模式上。我会在下面的回答里详细说明具体步骤,希望能帮到遇到同样问题的朋友。
备注:内容来源于stack exchange,提问作者YorSubs
相关产品推荐
相关产品推荐

