fix(sql): Implementar candado (reboot_lock) para romper bucle infinito de reinicio por reversión de registro del SO
This commit is contained in:
+7
-3
@@ -14,17 +14,17 @@ Log-Msg "=========================================================="
|
||||
|
||||
# SQL Server en Server Core chequea estrictamente estas claves del registro para el 'LanguageMismatch'
|
||||
$installLang = (Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Nls\Language" -Name "InstallLanguage").InstallLanguage
|
||||
if ($installLang -ne "0C0A") {
|
||||
if ($installLang -ne "0C0A" -and !(Test-Path "C:\reboot_lock.txt")) {
|
||||
try {
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Nls\Language" -Name "InstallLanguage" -Value "0C0A"
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Nls\Language" -Name "Default" -Value "0C0A"
|
||||
Set-WinSystemLocale -SystemLocale es-ES
|
||||
Set-WinUserLanguageList -LanguageList es-ES -Force
|
||||
|
||||
Set-Content -Path "C:\reboot_lock.txt" -Value "BLOQUEO DE REINICIO INFINITO"
|
||||
Log-Msg "Claves de registro de Idioma inyectadas a 0C0A (Espanol)."
|
||||
Log-Msg "REINICIO OBLIGATORIO DETECTADO. El OS necesita reiniciar para volcar el registro a RAM."
|
||||
Log-Msg "REINICIO OBLIGATORIO PREVENTIVO DETECTADO. El OS necesita reiniciar."
|
||||
Log-Msg "Reiniciando servidor DB01 en 3 segundos..."
|
||||
Log-Msg "Operador: Cuando la maquina virtual haya vuelto, ejecuta el C2 Launcher de nuevo."
|
||||
Start-Sleep -Seconds 3
|
||||
Restart-Computer -Force
|
||||
exit
|
||||
@@ -33,6 +33,10 @@ if ($installLang -ne "0C0A") {
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Path "C:\reboot_lock.txt") {
|
||||
Log-Msg "Reinicio previo ejecutado. El OS revertio el registro InstallLanguage a $installLang. Rompiendo bucle infinito."
|
||||
}
|
||||
|
||||
|
||||
$locale = Get-WinSystemLocale
|
||||
|
||||
|
||||
Reference in New Issue
Block a user