Turn Location Services ON/OFF

SOTI MobiControl
Windows

As an IT administrator, managing location services is crucial for ensuring compliance with your organization’s security and privacy policies. With the Turn Location Services On/Off script, you can remotely enable or disable location services on company-owned Windows devices. This allows you to ensure that apps that require location access can function properly, without users being able to disable these settings. Alternatively, you may choose to restrict location access entirely to improve security, preventing apps from tracking or using location data. By centrally managing these settings via SOTI MobiControl, you can maintain control over the privacy and security of your organization's devices.

Important:
  • It is recommended to test the script on a local/ test machine for its purpose and effects. 
  • SOTI MobiControl will not be responsible for any damage/loss to the data/setup based on the behavior of the script.

Turn on location services

1 $Name = "LetAppsAccessLocation"
2 $Value = 1
3 $Path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy"
4 If ((Test-Path $Path) -eq $false){
5 New-Item -Path $Path -ItemType Directory
6 }
7 If (-!(Get-ItemProperty -Path $Path -Name $name -ErrorAction SilentlyContinue)){
8 New-ItemProperty -Path $Path -Name $Name -Value $Value
9 }
10 else{
11 Set-ItemProperty -Path $Path -Name $Name -Value $Value
12 }

Turn off location services

1 $Name = "LetAppsAccessLocation"
2 $Value = 2
3 $Path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy"
4 If ((Test-Path $Path) -eq $false){
5 New-Item -Path $Path -ItemType Directory
6 }
7 If (-!(Get-ItemProperty -Path $Path -Name $name -ErrorAction SilentlyContinue)){
8 New-ItemProperty -Path $Path -Name $Name -Value $Value
9 }
10 else{
11 Set-ItemProperty -Path $Path -Name $Name -Value $Value
12 }

Was this helpful?

Need more help?
Ask Community