Detecting Detached Databases

  • AllegedDBA wrote:

    I know this an older thread, but in case anyone's still looking, Chrissy and Friends over at dbatools.io have it covered: https://docs.dbatools.io/#Get-DbaDbDetachedFileInfo  

    I could certainly be incorrect but that looks like you need to already know the path and file name.  The original post was about how to find them.

    That, notwithstanding, that looks like some pretty awesome code that does interrogate a known MDF file quite nicely.  Thanks for posting the link.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Quite right, sir.  The dbatools.io script is dandy, but doesn't address the OP's question.  It looks like the script posted by the OP and tweaked by Jack 95169 will do so.  If your situation allows you to enable xp_cmdshell, that is. 😉

    "If the women don't find you handsome, they should at least find you handy." Red Green

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply