Get the remote server's sql server database file path !

Hi,

I configured the sql server as E:-drive for default db files(master.mdf and .ldf , model .mdf and ldf and same remaining two dbs ) and F: drive to store the custom db data files (user created db such as x.mdf) and G: drive for custom db log file (x.ldf).

x is my local server and y is remote server .

I need to fetch the y’'s sql server file location from x.

so here my question , I used registry path to get the sql data root which is default db files

registry path “SOFTWARE\Microsoft\Microsoft SQL Server\$p\Setup”. how can I get the path for custom db data files and log files in remote server if I configured as mentioned above . Is there any way to get the path from registry or another service in windows .

Note:- There is no option to use the query to get form the sqlsever inbuilt tables or procedures .

There are many queries to get the MDF\LDF path:

Why would this method not work?

Hi Rob ,

Yeah Rob there are many queries from which we can get the mdf and ldf file paths. But in my case I need to fetch it through Registry which is from OS level where query is application level .

So I found the location "Computrer\HKey_Local_Machine\SOFTWARE\Microsoft\Microsoft SQL Server\instance Name \MSSQLServer " .

Thanks Rob ! !