Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
20 changes: 14 additions & 6 deletions WINDOWS/Scripts/Enable-AutoTimezone.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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") {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion WINDOWS/Scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down