20-sep: [scripts] Autologon - scripts verificacion/correccion + doc actualizada
This commit is contained in:
33
scripts/disable_autologon.ps1
Normal file
33
scripts/disable_autologon.ps1
Normal 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
|
||||
Reference in New Issue
Block a user