Is there a way to access the properties of "Out of Serice" Database?

Hi everyone,

I need to run a code that checks on DBs listed on a spreadsheet.

– If database is not on the path specified, i need to log “Unable to find database”.

– If it is “out of service” already, i need to log “DB already marked out of service”.

– If db is found, i need to mark it out of service and log “Marked out of service”.

My problem is, I can’t seem to differentiate a db not existing in path/server and a db that’s been marked out of service. I’m getting the same error for both (“Error 4063: …nsf has not been opened yet”) when using “db is open”, then accessing the property.

Is there a way where I can check if a database exists in a specific path, different from the checking if database is no longer in service?

Really appreciate your help :slight_smile: