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

Welcome Forums General PowerShell Q&A Get the remote server's sql server database file path !

Viewing 2 reply threads
  • Author
    Posts
    • #194585
      Participant
      Topics: 3
      Replies: 2
      Points: 20
      Rank: Member

      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 .

    • #194645
      Participant
      Topics: 10
      Replies: 1381
      Points: 1,509
      Helping Hand
      Rank: Community Hero

      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:

      https://stackoverflow.com/questions/9630279/listing-information-about-all-database-files-in-sql-server

      Why would this method not work?

    • #194888
      Participant
      Topics: 3
      Replies: 2
      Points: 20
      Rank: Member

      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 ! !

Viewing 2 reply threads
  • You must be logged in to reply to this topic.