none
DPM 2012 SP1 powershell - узнать срок истечения хранения данных на ленте RRS feed

Ответы

  • Как-то так:

    ################################################################################################
    #                                                                                              #
    # This script will parse all active protection group that is configured for long term          #
    # protection to tape                                                                           #
    # It will parse all tapes which are already set as offsite ready                               #
    # It will list all expiration date of these tapes. Currently it will list a tape even if it is #
    # set to expire months or years in advance.                                                    #
    #                                                                                              #
    # Author        : Wilson Souza                                                                 #
    # Script Name   : wilson-duetape.ps1                                                           #
    # Date Created  : 06/26/2011                                                                   #
    # Last modified : 03/13/2012                                                                   #
    # Version       : 1.3                                                                          #
    #                                                                                              #
    # Change log                                                                                   #
    # ==========                                                                                   #
    #                                                                                              # 
    #       Ver 1.3 - Added option to show output with Tape Label instead of Barcode               #
    #                 To switch to Label just enter the script name followed by word label         #
    #                 Example: .\duetape.ps1 label                                                 #
    #       Ver 1.2 - Output now is saved on file duetape.txt                                      #
    #       Ver 1.1 - Expire date/time information was masked to only show the date but not the    #
    #                 time. Took mask out so now we return date and time.                          #
    #                                                                                              #
    # This version of the script was only tested on DPM 2010                                       #
    #                                                                                              #
    ################################################################################################
    
    param([string] $barcode)
    if ($barcode.toupper() -ne 'LABEL') { $barcode = 'barcode' }
    $confirmpreference = "None"
    cls
    $dpmserver = connect-dpmserver (&hostname)
    $pg = @(get-protectiongroup (&hostname) | where { $_.protectionmethod -like "*Long-term using tape*"}) 
    out-file duetape.txt -encoding ASCII
    foreach ($pg1 in $pg)
    {
    	$rp = @()
    	write-host "Protection Group" $pg1.friendlyname "has tape protection" -foreground white
    	$ds = @(get-datasource $pg1)
    	foreach ($ds1 in $ds)
    	{
    		if ((get-recoverypoint $ds1 | where { $_.datalocation -eq "Media"}) -ne $null)
    		{
    			$rp = $rp + (get-recoverypoint $ds1 | where { $_.datalocation -eq "Media"})
    		}
    	}
    	$tp = @(get-tape -protectiongroup $pg1)
    	foreach ($tp1 in $tp)
    	{
    		if ($tp1.Isoffsiteready -eq $true)
    		{
    			$expire = get-date 
    			write-host "Recovery Points present on tape with" $barcode $tp1.$barcode 
    			foreach ($rp1 in $rp)
    			{
    				if ($tp1.id -eq $rp1.RecoverySourceLocations[0].mediamaplist[$rp1.RecoverySourceLocations[0].mediamaplist.count-1].mediaid)
    				{
    					write-host $rp1.RecoverySourceLocations[0].creationdatetime " - " $rp1.RecoverySourceLocations[0].expirydate " - " $tp1.$barcode "-" $rp1.recoverysourcelocations[0].generation -foreground red
    					if ($expire -lt $rp1.RecoverySourceLocations[0].expirydate)
    					{
    						$expire = ($rp1.recoverysourcelocations[0].expirydate)
    					}
    				}
    					
    			}
    			if ($tp1.location.isoffline)
    			{
    				write-host "Offsite Tape with" $barcode $tp1.$barcode "is due back to Library on" $expire "`n" -foreground yellow
    				"Offsite Tape with " + $barcode + " " + $tp1.$barcode + " is due back to Library on " + $expire | out-file duetape.txt -encoding ASCII -append
    			}
    			else
    			{
    				write-host "Tape in" $tp1.location.name "-" $tp1.location.id "expires on" $expire "`n" -foreground green
    				"Tape in " + $tp1.location.name + "-" + $tp1.location.id +" expires on " + $expire | out-file duetape.txt -encoding ASCII -append
    			}
    		}
    	}
    }


    My DPM blog ystartsev.wordpress.com

    • Помечено в качестве ответа Schriftsteller 8 апреля 2013 г. 10:21
    8 апреля 2013 г. 10:13
    Модератор