PI Services

Le blog des collaborateurs de PI Services

Intune : Définir le fuseau horaire automatiquement dans Windows 10/11

Afin de détecter les appareils Windows où l'option "Définir le fuseau horaire automatiquement" est désactivée, il suffit d'utiliser un script de remédiation Intune.

Script de détection :

$registrySettings = @(
    @{ Path = "HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate"; Name = "Start"; DesiredValue = 3 }
)


    # test if the registry path exists
    if ((Test-Path $registrySettings.Path)) {

        # get the current value of the registry key
      
        $currentValueTZauto = (Get-ItemProperty -Path $registrySettings.Path -ErrorAction SilentlyContinue).$($registrySettings.Name)
  

        # If the current value is not the desired value, update it
        if ($currentValueTZauto -ne $registrySettings.DesiredValue) {
            Write-Host "the current value is Start=$currentValueTZauto, and it is not the desired value"
			exit 1
        } else {
            # If the current value is already correct, do nothing
            Write-Host "the current value is Start=$currentValueTZauto, and it is the desired value"
			exit 0
        }

    } else {
        # If the registry path does not exist, log a warning
        Write-Warning "Registry path $($registrySettings.Path) does not exist."
		exit 1
    }

 

Ajouter un commentaire

Loading