• I've knocked together this short script that I run from Master. Forgive any scripting stupidity - I'm not a DBA - but I think you get the general approach. It assumes you have some idea where the .mdf files are. I'm sure someone could improve on it but it does what I need at the moment.

    ------------------------------

    if exists (select name from sysobjects where name ='temp_mdf_files') drop table temp_mdf_files

    if exists (select name from sysobjects where name ='temp_mdf_dbnames') drop table temp_mdf_dbnames

    create table temp_mdf_files (

    full_filename varchar(200))

    create table temp_mdf_dbnames (

    pos_dbname varchar(200))

    insert temp_mdf_files

    exec xp_cmdshell 'dir e:\*.mdf /s/b'

    inserttemp_mdf_dbnames

    select reverse(

    substring( reverse(

    substring(full_filename,1,datalength(full_filename)-4)) ,1,patindex('%\%', reverse(full_filename))-5)

    )

    from temp_mdf_files

    order by 1

    select * from temp_mdf_dbnames

    where pos_dbname not in (select name from sysdatabases)

    drop table temp_mdf_files

    drop table temp_mdf_dbnames