Detecting Detached Databases

  • Jeff Moden

    SSC Guru

    Points: 994284

    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.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."
    When you put the right degree of spin on it, the number 3|8 is also a glyph that describes the nature of a DBAs job. 😉

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

  • AllegedDBA

    Newbie

    Points: 2

    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 17 (of 17 total)

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