From deeeb1682d40173b23a257d9c7c5e1104fd64d46 Mon Sep 17 00:00:00 2001 From: goofoo Date: Tue, 3 Nov 2026 14:17:48 -0500 Subject: [PATCH] fix: align Windows grace period and timezone script with docs - Set Security Intelligence compliance grace period to 6 hours (0.25 days) to match the windows-v4.0 changelog. Fixes #262 - Correct Enable-AutoTimezone README to assign to Devices, matching the script header and its HKLM-only changes. Fixes #197 - Enable-AutoTimezone v1.2: turn on system location through SystemSettingsAdminFlows.exe and write SensorPermissionState before restarting lfsvc, so the service no longer reverts it. Refs #160, #209 Co-Authored-By: Claude Opus 5.5 --- ...er - U - Security Intelligence - v4.0.json | 2 +- WINDOWS/Scripts/Enable-AutoTimezone.ps1 | 20 +++++++++++++------ WINDOWS/Scripts/README.md | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/WINDOWS/IntuneManagement/CompliancePolicies/Win - OIB - CP - Defender - U - Security Intelligence - v4.0.json b/WINDOWS/IntuneManagement/CompliancePolicies/Win - OIB - CP - Defender - U - Security Intelligence - v4.0.json index 9ea3bb7..97940e0 100644 --- a/WINDOWS/IntuneManagement/CompliancePolicies/Win - OIB - CP - Defender - U - Security Intelligence - v4.0.json +++ b/WINDOWS/IntuneManagement/CompliancePolicies/Win - OIB - CP - Defender - U - Security Intelligence - v4.0.json @@ -44,7 +44,7 @@ "actionType": "block", "notificationMessageCCList@odata.type": "#Collection(String)", "notificationMessageCCList": [], - "gracePeriodHours": 0, + "gracePeriodHours": 6, "id": "57c4a0c7-b60b-49c6-b41c-cbeec62eaa55", "notificationTemplateId": "00000000-0000-0000-0000-000000000000" } diff --git a/WINDOWS/Scripts/Enable-AutoTimezone.ps1 b/WINDOWS/Scripts/Enable-AutoTimezone.ps1 index 35c3852..4dba16a 100644 --- a/WINDOWS/Scripts/Enable-AutoTimezone.ps1 +++ b/WINDOWS/Scripts/Enable-AutoTimezone.ps1 @@ -4,8 +4,8 @@ .NOTES Author: James Robinson | SkipToTheEndpoint | https://skiptotheendpoint.co.uk - Version: v1.1 - Release Date: 2024-08-31 + Version: v1.2 + Release Date: 2026-11-03 Intune Info: Script type - Platform Script @@ -29,6 +29,7 @@ $LocationValue = "Allow" # Allow - Forces the "Let apps access your location" to $AutoTZValue = "3" # 3 - Enables the automatic time zone setting. $LFSVCValue = "1" # 1 - Enables location services. $SensorValue = "1" # 1 - Enables the Windows Location Platform for the SENSOR_CATEGORY_LOCATION device sensor set: https://learn.microsoft.com/en-us/windows/win32/sensorsapi/sensor-category-location. +$AdminFlow = "$env:windir\System32\SystemSettingsAdminFlows.exe" # Used by the Settings app itself to toggle the system-wide location switch, which lfsvc honours on restart. #### Functions #### function Start-Logging { @@ -64,9 +65,19 @@ try { # Set the location value Set-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Name "Value" -Value $LocationValue - # Enable Auto Timezone value and (re)start service + # Turn on the system-wide location switch the supported way, as the registry values alone are reverted by lfsvc on restart (#160) + if (Test-Path $AdminFlow) { + Write-Host "Enabling system location via $AdminFlow" + Start-Process -FilePath $AdminFlow -ArgumentList "SetCamSystemGlobal location 1" -Wait -WindowStyle Hidden + } + else { + Write-Host "$AdminFlow not found, relying on registry values only" + } + + # Enable Auto Timezone value and sensor value, then (re)start service so it picks them up Set-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate" -Name "Start" -Value $AutoTZValue Set-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Value $LFSVCValue + Set-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Value $SensorValue Write-Host "(Re)Starting geolocation service" $lfsvc = Get-Service -Name lfsvc if ($lfsvc.Status -ne "Running") { @@ -75,9 +86,6 @@ try { else { Restart-Service -Name lfsvc -Force } - - # Set sensor value - Set-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Value $SensorValue Exit 0 } catch { diff --git a/WINDOWS/Scripts/README.md b/WINDOWS/Scripts/README.md index 04059ec..484af78 100644 --- a/WINDOWS/Scripts/README.md +++ b/WINDOWS/Scripts/README.md @@ -10,7 +10,7 @@ I have tried to utilise available settings to make this work as part of the Time ### Usage **Script type** - Platform Script -**Assign to** - Users +**Assign to** - Devices **Script Settings:** - Run this script using the logged on credentials - No - Enforce script signature check - No