Hi,
I use command "Backup Database " to disk to copy databases programmatically. However this command requires to specify exactly where to put the backup. I don't know in advance on which machine the script will be run so I don't know where specific MSSQL server has permission to write. Perfect place would, of course, be MSSQL data folder (for example on my machine: C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA).
It would be perfect if I could somehow query SQL Server DATA folder path from the script. Is there any way?