So, I am quite a keen user of PowerShell and System Centre Orchestrator. Ok, so I recently had a request from a customer that went as follows “I need DPM to alert me when tapes are ready to be taken off-site.”
DPM does not seen to have this functionality out of the box within the Graphical User Interface (GUI). All is NOT lost, Data Protection Manager has a PowerShell component and i was sure i could figure out a way to get this to work within PowerShell. Sure enough a solution in the form of PowerShell was found, so using this as a base, I modified the PowerShell script to suit my needs. It was also slightly modified to use with System Centre Orchestrator. The custoemr also wanted some colour and wanted the result formatted in HTML. primarily for reading purposes and auditing purposes. PowerShell code below and link here.
Import-Module DataProtectionManager $date = Get-Date -Format "M-d-yyyy" $path = "c:\DPMOffisteTapes\" $filepath = $path + $date + ".html" #creates the folder if it does not exist New-Item -itemType file -Path $filepath $AllLibraries = get-dpmlibrary $AllTapes = Get-Tape -DPMLibrary $AllLibraries $offistereadytape = $AllTapes | Where-Object {$_.isoffsiteready -eq $true} $a = "<style>" $a = $a + "BODY{background-color:Green;}" $a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}" $a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:GreenYellow}" $a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:palegoldenrod}" $a = $a + "</style>" $offistereadytape | Select-object location, barcode , isoffsiteready|ConvertTo-Html -Head $a -Body "<H2>Offsite Ready Tapes</H2>" | out-file -FilePath $filepath
OK, so now we have the data in decent format.
So, with the more tapes that are ready, the more rows of data will be within the HTML.
Ok, so now we need to schedule the task. I know i could have used Task Scheduler and the like, however we have System Centre Orchestrator and with Service Management Automation available, more and more tasks will be automated. With this example, i decided to use Orchestrator.
So, I simply use a Monitor/Date Time to run the required activity at set intervals
I then run a DPM Script from the Data Protection Manager Integration Pack.
The filepath Variable is where the html (the full path to the html file) is written, this is especially helpful when sending the Email Message. (I know this can be done with send-mailmessage directly within the PowerShell code)
So there you have it, Some Orchestrator Magic with PowerShell and DPM.
Follow me.
Facebook (Personal)
Twitter (Personal & System Centre)
Twitter (System Centre Focused)
Filed under: DPM Tagged: DPM, Powershell, SCORCH, script
