I want to get geolocation of a user based on its IP address and then later using these values further along with the script. I am using this command.
$pos=(Invoke-RestMethod http://ipinfo.io/loc)
This command returns me latitude and longitude value separated by a comma (,). as shown below.
-20.003,110.009809
How can I access/index them separately and store as a separate variable? For example, If I use $pos[1], it does not return me longitude value.
Please also suggest if there is some better way of doing it in windows cmd rather than power shell.