none
DPM - Output Full List of Protection Schedules Powershell or Reporting Services RRS feed

  • Question

  • Hello,

    Running DPM 2012 R2 UR9.

    I'm looking for some powershell or DPM reporting help.  The goal is to have a script or report run daily to update a doc/place on a shared location so the rest of the team can quickly view backup schedules.  I can't seem to grasp how to obtain the schedule of a protected server without going into the console.

    For example, A simple .csv export for -->  Protection group, Protected Member, Protection Schedule/Objective (short-term).

    Or

    A simple report via SQL reporting services - I can't seem to track down the proper tables...  

    I found the following script to display the schedule for each protection group, (not including the protected servers).

    $PGlist = Get-DPMProtectionGroup -DPMServerName $Env:COMPUTERNAME
    foreach ($PG in $PGlist){$PG.FriendlyName;Get-DPMPolicyObjective -ProtectionGroup $PG -ShortTerm | select Schedules | Format-Table -HideTableHeaders}

    When I pipe export-csv the screen output does not include the schedule. (I'm guessing this isn't even the correct syntax)

    $PGlist = Get-DPMProtectionGroup -DPMServerName $Env:COMPUTERNAME
    foreach ($PG in $PGlist){$PG.FriendlyName;Get-DPMPolicyObjective -ProtectionGroup $PG -ShortTerm | select schedules | Format-Table -HideTableHeaders| Export-Csv c:\schedule.csv}


    I've exhausted my searching and technical abilities - maybe I'm just missing something simple?  Any pointers would be greatly appreciated.

     

    Monday, March 21, 2016 9:24 PM

Answers

  • Thank you, i made few changes :

    $export = "C:\temp\Export\DPMSchedule.csv"
    if (test-path $export){remove-item $export -Recurse}
    
    $pgList = Get-ProtectionGroup $env:COMPUTERNAME
    
    ForEach($pg in $pgList) {
      
      $PGroup = Get-DPMPolicyObjective -ProtectionGroup $pg -ShortTerm 
      $dsList = Get-Datasource -ProtectionGroup $pg
    
      ForEach($ds in $dsList) {
    
        $line = $pg.Name+ ";"
        $line += $ds.PSInfo.Name + ";"
        $line += $ds.Name + ";"
        $line += $PGroup.Schedules + ";"
        
        $line | Tee-Object $export -Append
    
        }    
    }
    Regards


    Note: This posting is provided 'AS IS' with no warranties or guarantees, and confers no rights. Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable. This helps the community, keeps the forums tidy, and recognises useful contributions.

    Thursday, March 31, 2016 10:18 AM

All replies

  • Here's where I'm at now.

    I found this script:

    (thanks Rod!)

    https://social.technet.microsoft.com/Forums/en-US/7d4cde9a-2436-4b10-9f78-3e12250b9f6e/cant-get-usable-output-from-getprotectiongroup?forum=dataprotectionmanager

    $pgList = Get-ProtectionGroup $env:COMPUTERNAME
    
    ForEach($pg in $pgList) {
    
      $dsList = Get-Datasource -ProtectionGroup $pg
    
      ForEach($ds in $dsList) {
    
        $line = $ds.PSInfo.Name
    
        $line += "  " + $ds.Name
    
        $line += "  " + $ds.State
    
        Write-Output $line
    
      }
    
    }

    I updated it to get the "DPMPolicyObjective" and added a line for Schedules

    $pgList = Get-ProtectionGroup $env:COMPUTERNAME
    
    ForEach($pg in $pgList) {
    
      $PGroup = Get-DPMPolicyObjective -ProtectionGroup $pg -ShortTerm
    
      ForEach($ds in $dsList) {
    
        $line = $ds.PSInfo.Name
    
        $line += "  " + $ds.Name
    
        $line += "  " + $ds.State
    
        $line += $PGroup.Schedules
    
        write-output $line
    
       }
    
    } 

    This displays it on the screen.  Next objective is to figure out how to delimit/export-csv/htm or some sort of usable format.  

    Tried:

    - running the script from a shell to no avail.

    PS C:\Scripts> .\DPMschedule.ps1 > c:\scripts\test.txt

    PS C:\Scripts> .\DPMschedule.ps1 | Tee-Object -file c:\scripts\test.txt

    - adding export-csv at the end of the code to no avail.

    $Results | export-csv c:\scripts\test.csv

    A bit of progress. Will report back as I am able to work through this.

    Wednesday, March 23, 2016 12:46 PM
  • This works in ISE but not a regular prompt.

    It gives output on the screen and writes to a file.

    remove-item C:\scripts\DPMSchedule.csv -Recurse
    
    $pgList = Get-ProtectionGroup $env:COMPUTERNAME
    
    ForEach($pg in $pgList) {
    
      $PGroup = Get-DPMPolicyObjective -ProtectionGroup $pg -ShortTerm 
    
      ForEach($ds in $dsList) {
    
        $line = $ds.PSInfo.Name
    
        $line += "  " + ","
        
        $line += "  " + $ds.Name
    
        $line += "  " + ","
    
        $line += $PGroup.Schedules
    
        $line += "  " + ","
       
        $line  | Tee-Object "C:\Scripts\DPMSchedule.csv" -Append
    
        }    
    
    }


    Thursday, March 24, 2016 5:12 PM
  • Thank you, i made few changes :

    $export = "C:\temp\Export\DPMSchedule.csv"
    if (test-path $export){remove-item $export -Recurse}
    
    $pgList = Get-ProtectionGroup $env:COMPUTERNAME
    
    ForEach($pg in $pgList) {
      
      $PGroup = Get-DPMPolicyObjective -ProtectionGroup $pg -ShortTerm 
      $dsList = Get-Datasource -ProtectionGroup $pg
    
      ForEach($ds in $dsList) {
    
        $line = $pg.Name+ ";"
        $line += $ds.PSInfo.Name + ";"
        $line += $ds.Name + ";"
        $line += $PGroup.Schedules + ";"
        
        $line | Tee-Object $export -Append
    
        }    
    }
    Regards


    Note: This posting is provided 'AS IS' with no warranties or guarantees, and confers no rights. Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable. This helps the community, keeps the forums tidy, and recognises useful contributions.

    Thursday, March 31, 2016 10:18 AM
  • Thank you Matthias - the only change I made was using "`t" for the delimiter so the schedule would open in Excel without messing around.  MUCH appreciated!!!!! 
    Tuesday, May 3, 2016 2:07 PM