none
DPM automation tasks query RRS feed

  • Question

  • Dear Experts ,

    I'm currently working on DPM automation tasks

    Is it possible to use powershell scripts  to create an automation process which told us which tapes were used at the end of the month and send us some alerts ?

    Currently I'd tried using

    Get-ProtectionGroup –DPMServer (servername) | get-tape | select -ExpandProperty label | sort | out-file E:\Temp\DPMTapeLabelList.txt

    and I've got the list of tapes but sounds like it haven't reports the last used date for particular tape..

    Please advice..

    Many thanks.

    Friday, September 21, 2012 3:39 AM

Answers

  • Hello,

    I am no expert but I use this script for creating a list of tapes with CreationDate: tapelist.ps1
    It is based on a more complex script from Sean Kearney http://gallery.technet.microsoft.com/scriptcenter/fab7b8df-5288-4a67-bc11-61c9d3a27ed3
    but reduced and changed to my needs.

    # Get all Tapes of a library of a specific server
    #
    $TAPELIST=Get-ProtectionGroup -DPMServer SERVERNAME | get-tape | sort -Property label
     
    # Create file called DPMTapes.csv in the folder 
    # C:\Powershell 
    # 
     
    $FILENAME=’C:\Powershell\DPMTapes.csv’
     
    NEW-ITEM –path $FILENAME –itemtype File –force 
     
    # Create a header to start the file off.  This will be 
    # delimited with a Comma to make it a CSV 
    # 
     
    $HEADER=’TapeLabel,DayOfWeek,CreationDate,TapeLocation’ 
     
    ADD-CONTENT –path $FILENAME –value $HEADER 
    
    # Go through each tape and... 
     
    Foreach ( $TAPE in $TAPELIST ) { 
     
    # get wanted properties
    	echo $Tape.Label
     
    	 $TapeLabel=$Tape.Label
             $TapeLocation=$Tape.Location  
             $TapeDate=$Tape.CreationDate 
    	 $TapeDayOfWeek=(get-date $Tape.CreationDate).DayOfWeek
     
    
    # Now let's pull all of this stuff together into a nice  
    # single variable.
    	 $OUTPUT=$Tapelabel+’,’+$TapeDayOfWeek+’,’+$TapeDate+’,’+$Tapelocation
     
    # Add that onto our never ending CSV file 
             ADD-CONTENT –path $FILENAME –value $OUTPUT 
     
    } 

    And this batch file to run it from command line or as a scheduled task

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft DPM\DPM\bin\dpmshell.psc1" -command ".'pathtofile\tapelist.ps1'"

    Tuesday, December 4, 2012 1:00 PM

All replies

  • Hello,

    I am no expert but I use this script for creating a list of tapes with CreationDate: tapelist.ps1
    It is based on a more complex script from Sean Kearney http://gallery.technet.microsoft.com/scriptcenter/fab7b8df-5288-4a67-bc11-61c9d3a27ed3
    but reduced and changed to my needs.

    # Get all Tapes of a library of a specific server
    #
    $TAPELIST=Get-ProtectionGroup -DPMServer SERVERNAME | get-tape | sort -Property label
     
    # Create file called DPMTapes.csv in the folder 
    # C:\Powershell 
    # 
     
    $FILENAME=’C:\Powershell\DPMTapes.csv’
     
    NEW-ITEM –path $FILENAME –itemtype File –force 
     
    # Create a header to start the file off.  This will be 
    # delimited with a Comma to make it a CSV 
    # 
     
    $HEADER=’TapeLabel,DayOfWeek,CreationDate,TapeLocation’ 
     
    ADD-CONTENT –path $FILENAME –value $HEADER 
    
    # Go through each tape and... 
     
    Foreach ( $TAPE in $TAPELIST ) { 
     
    # get wanted properties
    	echo $Tape.Label
     
    	 $TapeLabel=$Tape.Label
             $TapeLocation=$Tape.Location  
             $TapeDate=$Tape.CreationDate 
    	 $TapeDayOfWeek=(get-date $Tape.CreationDate).DayOfWeek
     
    
    # Now let's pull all of this stuff together into a nice  
    # single variable.
    	 $OUTPUT=$Tapelabel+’,’+$TapeDayOfWeek+’,’+$TapeDate+’,’+$Tapelocation
     
    # Add that onto our never ending CSV file 
             ADD-CONTENT –path $FILENAME –value $OUTPUT 
     
    } 

    And this batch file to run it from command line or as a scheduled task

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft DPM\DPM\bin\dpmshell.psc1" -command ".'pathtofile\tapelist.ps1'"

    Tuesday, December 4, 2012 1:00 PM
  • Thanks mate,

    Will take some try and let you know how it comes :)

    Cheers

    Thursday, December 13, 2012 9:07 AM
  • Did the script addressed your issue?

    Thanks, Wilson Souza - MSFT This posting is provided "AS IS" with no warranties, and confers no rights

    Friday, March 1, 2013 8:25 PM
    Moderator