0

I'm troubleshooting Win10 PCs getting bad location information. The Windows Geolocation service puts them in Colorado when they should be in California. That changes the time zone and they miss meetings.

Anyway, I'm looking for the data that is being fed into the Geolocation service to see what could be causing the bad results. I think that the info will be in the Position source. The doc is here. And I would like to be able to access in the object in PowerShell for troubleshooting.

I can do something similar with the geolocation output which will show me the longitude and latitude like this:

Add-Type -AssemblyName System.Device
$GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher
$GeoWatcher.Start()

Can anyone "translate" how to load the correct assemblies for the Positionsource?

1 Answers1

0

Note, if you are doing this on office locked user, meaning, desktops/laptops/mobile devices, then it's going to report the location based on the egress gateway / external IPA, not the actual host location.

Yet, this sounds like a possible duplicate of this answer:

Powershell: Getting GPS Coordinates in Windows 10 - Using Windows Location API?

# Required to access System.Device.Location namespace
Add-Type -AssemblyName System.Device 

# Create the required object
$GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher 

# Begin resolving current locaton
$GeoWatcher.Start() 

while (($GeoWatcher.Status -ne 'Ready') -and ($GeoWatcher.Permission -ne 'Denied')) 
{
    #Wait for discovery.
    Start-Sleep -Milliseconds 100
}  

if ($GeoWatcher.Permission -eq 'Denied')
{Write-Error 'Access Denied for Location Information'} 
else 
{
    #Select the relevent results.
    $GeoWatcher.Position.Location | 
    Select Latitude,Longitude 
}

Yet, see the MS doc here:

PositionSource Enum

Indicates the source used to obtain a Geocoordinate.

Definition

  • Namespace : Windows.Devices.Geolocation
  • Assemblies : Windows.Devices.Geolocation.dll, Windows.dll

Geocoordinate Class

Contains the information for identifying a geographic location.

Definition

  • Namespace : Windows.Devices.Geolocation
  • Assemblies : Windows.Devices.Geolocation.dll, Windows.dll
postanote
  • 15,138
  • 2
  • 14
  • 25
  • Thanks, but that's a long version of what I posted, the code that will give info like long/lat/altitude. The PositionSource info should include the WAN (external) IP address and the MAC addresses of WAPs that the unit can see. That's MAC address info that it sends the server is what I'm trying to get to I've now made it far enough to realize that an Enum has to be loaded a little differently. https://stackoverflow.com/questions/45086059/how-can-i-reference-uwp-classes-in-powershell I'm still not sure how to find what was used for the location info in memory. – Steve Mahoney Nov 29 '19 at 23:59