I'm making an automation script to move tempDB files to another disk. I'm using DSC (with xSQLServerScript modules) to ensure consistent environment across multiple servers. In order not to touch servers that have tempDB in the right location already I need to reference a script that will return only True or False value. As I'm an SQL noob I would really appreciate if somebody would provide an example for such script. If that makes any difference here is the T-SQL script I use to move tempDB files:
Alter database tempdb modify file (name = tempdev, filename = 'D:\Sqldata\tempdb.mdf', SIZE = 1000MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20%)
Alter database tempdb modify file (name = templog, filename = 'D:\Sqldata\templog.ldf', SIZE = 100MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20%)
Somewhat unclear on what you want here but think you want to know if all files for tempdb are located on the D drive. Since I don't much care for strings representing true/false I am using the bit datatype here. The bit datatype will convert to 1 for any value that is not null and not 0.
select convert(bit, COUNT(*))
from tempdb.sys.sysfiles
where left(filename, 1) = 'D'