20-sep: [scripts] Autologon - scripts verificacion/correccion + doc actualizada

This commit is contained in:
juanminsanz
2026-09-20 22:24:10 +02:00
parent ac876f59c6
commit a0f99b897d
4 changed files with 249 additions and 14 deletions

View File

@@ -0,0 +1,33 @@
# Script para DESHABILITAR autologon
# Ejecutar como ADMINISTRADOR
# Verificar que se ejecuta como Admin
$esAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $esAdmin) {
Write-Host "[ERROR] Este script debe ejecutarse como Administrador." -ForegroundColor Red
exit 1
}
Write-Host "`n=== DESACTIVAR AUTOLOGON ===" -ForegroundColor Cyan
$winlogonPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
try {
# Deshabilitar autologon
Set-ItemProperty -Path $winlogonPath -Name "AutoAdminLogon" -Value "0"
# Eliminar contraseña almacenada (seguridad)
Remove-ItemProperty -Path $winlogonPath -Name "DefaultPassword" -ErrorAction SilentlyContinue
Write-Host "`n[OK] Autologon DESACTIVADO." -ForegroundColor Green
Write-Host "Al reiniciar, Windows pedirá contraseña normalmente." -ForegroundColor White
Write-Host "`nPara reactivar autologon correctamente:" -ForegroundColor Yellow
Write-Host " .\fix_autologon.ps1" -ForegroundColor White
} catch {
Write-Host "`n[ERROR] No se pudo deshabilitar autologon: $_" -ForegroundColor Red
exit 1
}
Write-Host "`n========================================`n" -ForegroundColor Cyan