Reputation: 1013
I have a list of possible paths to use for a default input data directory (X:\Data; Y:\Data; Z:\Data). All of the possible paths are mapped network drives. I can check this using GetDriveType(pathStr) == DRIVE_REMOTE
. To determine the best one, I have narrowed down the list by selecting only paths that exist. Sometimes there will be more than one path left in the list, so to determine the best one at that point, I want to find the IP address of the server that the drive is mapped to, so I can compare it to my own IP address. For instance, if I have X:\
mapped to \\RemoteComputer\ShareName
, how can I find out from the string X:\Data
either the name or IP address of RemoteComputer
? (I already have the ability to find the IP address from a computer name).
Upvotes: 1
Views: 14717
Reputation: 74654
Keep in mind, that not all (but the vast majority) of UNC paths start with a computer name. Some like WebDav, are a FQDN - others like TS remoting (i.e. \tsclient\c) aren't a machine at all, just a token that RDBSS recognizes.
Upvotes: 0