2017-09-18 17 views

答えて

2

System.Device.Locationメソッドの使用例は、これがあなたが探しているものである必要があります。

Add-Type -AssemblyName System.Device #Required to access System.Device.Location namespace 
$GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher #Create the required object 
$GeoWatcher.Start() #Begin resolving current locaton 

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

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