none
Export list of protected members RRS feed

  • Question

  • This can't be this hard.

    I'm trying to get a list of protected members for each protection group without having to manually write them all down.  I've found a powershell script but it's throwing an error.

    $GROUPLIST=GET-PROTECTIONGROUP -DPMSERVERNAME TMADPM01; foreach ( $MEMBER of $GROUPLIST ) { GET-DATASOURCE -ProtectionGroup $Member}

    Missing 'in' after variable in foreach loop.
    At line:1 char:75
    + $GROUPLIST=GET-PROTECTIONGROUP -DPMSERVERNAME TMADPM01; foreach ( $MEMBER  <<
    << of $GROUPLIST ) { GET-DATASOURCE -ProtectionGroup $Member}
        + CategoryInfo          : ParserError: (InToken:TokenId) [], ParentContain
       sErrorRecordException
        + FullyQualifiedErrorId : MissingInInForeach

    Surely just getting a list of protected members isn't this difficult.



    Ben Rollman

    Thursday, November 15, 2012 5:30 PM

Answers

  • Hi,

    You were close, this works.

     $GROUPLIST=GET-PROTECTIONGROUP -DPMSERVERNAME (&hostname); foreach ( $MEMBER in $GROUPLIST ) { GET-DATASOURCE -ProtectionGroup $Member}

    If you just want to specify a particular PG, use this and enter the PG name:

    Get-datasource –protectiongroup (get-protectiongroup (&hostname) | ? {$_.friendlyname –match “PG_FRIENDLY_NAME”})


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.


    Thursday, November 15, 2012 7:28 PM
    Moderator

All replies

  • Hi,

    You were close, this works.

     $GROUPLIST=GET-PROTECTIONGROUP -DPMSERVERNAME (&hostname); foreach ( $MEMBER in $GROUPLIST ) { GET-DATASOURCE -ProtectionGroup $Member}

    If you just want to specify a particular PG, use this and enter the PG name:

    Get-datasource –protectiongroup (get-protectiongroup (&hostname) | ? {$_.friendlyname –match “PG_FRIENDLY_NAME”})


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.


    Thursday, November 15, 2012 7:28 PM
    Moderator
  • That works, thanks.  Does the push out to a text file not work in this case?  I tried > c:\file.txt and got an error.  Works on my exchange powershell.


    Ben Rollman

    Thursday, November 15, 2012 7:33 PM
  • Ben,

    I modified Mike Jacquet's script just a bit since I also wanted a usable output:

    # add the DPM snapin to allow the script to run in Windows Powershell Add-PSSnapIn "Microsoft.DataProtectionManager.PowerShell" -ErrorAction SilentlyContinue

    # turn off confirmation prompts

    $ConfirmPreference = "None"

    # set hostname and output file variables $hostname = (&hostname) $outfile = "[path you want to save to]" + $hostname + "_DPMDataSources.csv" # Delete the output file if it already exists If (Test-Path $outfile) {Remove-Item $outfile } Else { } # perform the actual data collection $GROUPLIST=GET-PROTECTIONGROUP -DPMSERVERNAME $hostname foreach ( $MEMBER in $GROUPLIST ) { GET-DATASOURCE -ProtectionGroup $Member >> $outfile }

    Just change the [path you want to save to] and you will get a filed named [Hostname]_DPMDataSources.csv so you can collect reports from different DPM servers without overwriting the data.

    Hope that helps,

    Mike Hay




    • Edited by Mike Hay Tuesday, April 2, 2013 7:51 PM
    • Proposed as answer by Damian Lynch Monday, May 13, 2013 1:06 PM
    Tuesday, April 2, 2013 7:17 PM
  • Sorry I'm not sure whether to create a new discussion or continue this thread... re the script above (and the original script) in my experience the output doesn't exactly match the protected members configured in DPM.

    For example in the DPM Administrator Console I can see I'm backing up the folder F:\SQL_BACKUPS on SERVER1 whereas the script doesn't show the individual folder being backed up but rather the volume it sits on.

    GUI

    Powershell

    Is it possible to modify the script to show the Folder path rather than the Volume? Thanks.

    • Proposed as answer by USRS Monday, September 18, 2017 6:47 AM
    Thursday, September 19, 2013 6:26 AM
  • I was needing to provide a report listing all the protected folders that are setup in DPM. The suggested answer in this thread only lists the volume on which the protected folders reside, but doesn't list the folders themselves.

    I found I can go in the Protection tab, then expand all the protection groups, then press CTRL-A to select them all, then press CTRL-C to copy them and I can then paste them into notepad or Excel. The contents of the clipboard will contain all the protected folders, but you'll have to prune out extra stuff, like inactive protection if you have that.

    Better than nothing, I'd rather use powershell, but so far this is the only way I've found to pull that information out of DPM. If anyone has a better way, I'd love to hear about it.
    Friday, September 15, 2017 8:48 PM
  • no bacu up
    Monday, September 18, 2017 6:45 AM