AutoLogon_enable

AutoLogon_enable

### Enable 'AutoLogon' 
Set-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "AutoAdminLogon" -Value "1"

### Specify for which user AutoLogon should be enabled
Set-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUsername" -Value "Administrator"

### Extract the initial Administrator Password from the VMWare Config
$vmwaretoolspath = "C:\Program Files\VMware\VMware Tools\vmtoolsd.exe"
$tmp = & $vmwaretoolspath --cmd "info-get guestinfo.cloudinit.metadata" | Out-String
$tmp = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($tmp))
$tmp = $tmp -split "`n"
$tmp = $tmp | Select-String -Pattern "admin_pass"
$password = $tmp.ToString().substring(12)

### Set the Administrator Password
Set-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultPassword" -Value "$password"

You may also like...