【问题标题】:Show inputs for Geolocation on Win10在 Win10 上显示地理位置输入
【发布时间】:2019-11-28 05:42:40
【问题描述】:

我正在对获取错误位置信息的 Win10 电脑进行故障排除。 Windows 地理定位服务将他们放在科罗拉多州,而他们应该在加利福尼亚州。这会改变时区,他们会错过会议。

无论如何,我正在寻找输入地理定位服务的数据,以查看可能导致不良结果的原因。我认为信息将在位置源中。文档是here。 而且我希望能够在 PowerShell 中访问对象以进行故障排除。

我可以对地理定位输出做类似的事情,它会像这样向我显示经度和纬度:

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

谁能“翻译”如何为 Positionsource 加载正确的程序集?

【问题讨论】:

    标签: windows powershell geolocation


    【解决方案1】:

    注意,如果您在办公室锁定的用户(即台式机/笔记本电脑/移动设备)上执行此操作,那么它将根据出口网关/外部 IPA 报告位置,而不是实际主机位置。

    然而,这听起来可能是这个答案的重复:

    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 
    }
    

    但是,请在此处查看 MS 文档:

    PositionSource Enum

    表示用于获取地理坐标的来源。

    定义

    • 命名空间:Windows.Devices.Geolocation
    • 程序集:Windows.Devices.Geolocation.dll、Windows.dll

    Geocoordinate Class

    包含用于识别地理位置的信息。

    定义

    • 命名空间:Windows.Devices.Geolocation
    • 程序集:Windows.Devices.Geolocation.dll、Windows.dll

    【讨论】:

    • 谢谢,但这是我发布的内容的长版本,代码将提供诸如 long/lat/altitude 之类的信息。 PositionSource 信息应包括设备可以看到的 WAN(外部)IP 地址和 WAP 的 MAC 地址。那是它发送给服务器的 MAC 地址信息是我想要获取的信息,我现在已经做到了足够远,意识到必须以不同的方式加载 Enum。 stackoverflow.com/questions/45086059/…我仍然不确定如何在内存中找到用于位置信息的内容。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多