20-sep: [automatizacion] Morning routine (Tapo + WoL + AutoLogon + Apertura de pestañas)
This commit is contained in:
22
scripts/morning_routine/enable_autologon.ps1
Normal file
22
scripts/morning_routine/enable_autologon.ps1
Normal file
@@ -0,0 +1,22 @@
|
||||
param(
|
||||
[Parameter(Mandatory=$true, HelpMessage="Introduce la contrasena/PIN de Windows")]
|
||||
[string]$Password
|
||||
)
|
||||
|
||||
# Detectar usuario actual
|
||||
$username = $env:USERNAME
|
||||
$domain = $env:USERDOMAIN
|
||||
|
||||
$winlogonPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
|
||||
|
||||
try {
|
||||
Set-ItemProperty -Path $winlogonPath -Name "AutoAdminLogon" -Value "1"
|
||||
Set-ItemProperty -Path $winlogonPath -Name "DefaultUserName" -Value $username
|
||||
Set-ItemProperty -Path $winlogonPath -Name "DefaultPassword" -Value $Password
|
||||
Set-ItemProperty -Path $winlogonPath -Name "DefaultDomainName" -Value $domain
|
||||
|
||||
Write-Host "[OK] AutoLogon habilitado correctamente para $domain\$username." -ForegroundColor Green
|
||||
Write-Host "Al encenderse, el PC entrara directo a este escritorio sin pedir clave." -ForegroundColor Cyan
|
||||
} catch {
|
||||
Write-Host "[ERROR] Necesitas ejecutar este script como Administrador." -ForegroundColor Red
|
||||
}
|
||||
Reference in New Issue
Block a user