Is it Possible to get my country name/code using uipath activities?


Is it Possible to get my country name/code using uipath activities ?



From where you want to read country name or code ?

From my computer current location ( either from IP Address or PC Settings), I want to use is as input, like getting actual time using: DateTime.Now.ToString(“yyyy-MM-dd HH:mm:ss”). Thanks

As far as I can tell, Windows has no way to accurately tell where a machine is actually located. However, there are online services that can look up approximate geographical location based on your ip address. Keep in mind that this won’t always be very accurate. If you use a VPN, are masked by your ISP, or are on a business network your ip may not appear close to where you are. For example, when the services “find” me they are actually several hundred miles off.

1 Like

Total agree, if there is no command from windows to print the bellow info ( region ), it will not be possible, otherwise it will be possible as this information will not be changed even when using VPN networks.


I just found this:

PS C:\> Get-ItemProperty 'HKCU:\Control Panel\International\Geo\'

PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Control Panel\International\Geo\
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Control Panel\International
PSChildName  : Geo
PSDrive      : HKCU
PSProvider   : Microsoft.PowerShell.Core\Registry
Nation       : 244

The nation code returned by this command can be mapped here to a country name. You could download the country code list separately and store it locally for reference.

Why the Nation is the same ? even me I got 244 !!!

Because we’re in the same country. That’s the code for the United States.

You’re right My PC is Configured to “US” that’s why we got same Nation Code : Thanks Daniel :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.