Replace
$SqlCmd.CommandText = "select f.physical_name from sys.master_files f, sys.databases d where f.database_id = d.database_id and
d.name = 'master'"
With
$SqlCmd.CommandText = "select f.physical_name from sys.master_files f, sys.databases d where f.database_id = d.database_id and
d.name = '$DESTINATIONDB'"
That should work.
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!