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
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
someone pointed me to this
https://github.com/sqlcollaborative/dbatools/blob/master/functions/Get-DbaDefaultPath.ps1
and using
SELECT SERVERPROPERTY('InstanceDefaultdataPath')
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
15 People are following this question.