The following script runs detailed inventory on all unknown tapes in all the libraries attached to the specified DPM server. Save this script as a .ps1 file and run it. Usage and examples of scripts can be found by calling them with ‘-?’ or ‘-help’ from inside DPM Management Shell.

This is for manually running the detailed inventory job. Btw, for running the inventory on a regular scheduled basis, then use Get/Set-MaintenanceJobStartTime and DPM will automatically run the inventory at the specified time.

-------------------------------- Start of Script ----------------------------------------

param ([string] $DPMServerName)

if(("-?","-help") -contains $args[0])
{
    Write-Host "Description: This script runs detailed inventory on all unknown tapes in all the libraries attached to the specified DPM server."
    Write-Host "Usage: Inventory-UnknownTapes.ps1 [-DPMServerName] <Name of the DPM server>"
    Write-Host "Example: Inventory-UnknownTapes.ps1 mohitc02"

    exit 0
}

if (!$DPMServerName)
{
    $DPMServerName = Read-Host "DPM server name"

    if (!$DPMServerName)
    {
        Write-Error "Dpm server name not specified."
        exit 1
    }
}

if (!(Connect-DPMServer $DPMServerName))
{
    Write-Error "Failed to connect To DPM server $DPMServerName"
    exit 1
}

$libraryList = Get-DPMLibrary -DPMServerName $DPMServerName

foreach ($library in $libraryList)
{
    $unknownTapeList = @(Get-Tape -DPMLibrary $library | ? {$_ -is [Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.LibraryManagement.ArchiveMedia] -and $_.OmidState -eq "Unknown"})

    if ($unknownTapeList.Length -gt 0)
    {
        Write-Host "Starting detailed inventory on $($library.UserFriendlyName) for $($unknownTapeList.Length) tape(s)."
        Start-DPMLibraryInventory -DPMLibrary $library -DetailedInventory -Tape $unknownTapeList
    }
}

----------------------------------- End of Script ---------------------------------------

- Mohit Chakraborty