question

wall-str33t avatar image
wall-str33t asked

Where to get default mdf and log file locations for 2019?

We were using something like the following script but they seem to have removed the reg locations for 2019

https://www.sqlservercentral.com/articles/setting-sql-server-default-locations

logmdf
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

wall-str33t avatar image
wall-str33t answered

someone pointed me to this

https://github.com/sqlcollaborative/dbatools/blob/master/functions/Get-DbaDefaultPath.ps1

and using

SELECT SERVERPROPERTY('InstanceDefaultdataPath')

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image
Kev Riley answered

The registry keys will not exist unless you have edited the default locations.

So in my SQL2019 default instance, the locations (as per Database Settings in Server Properties) is

C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\

for both data and logs

C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL is the 'root' path of the instance

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.