Description
Runs detailed inventory on all unknown tapes in all the libraries attached to the specified DPM server. This is for manually running the detailed inventory job. In order to run the inventory on a regular scheduled basis, use Get/Set-MaintenanceJobStartTime and DPM will automatically run the inventory at the specified time. 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 script was contributed by the System Center Data Protection Manager (DPM) team.
Supported Platforms
Windows Server 2003 | Yes, with Service Pack 1 |
Windows XP | No |
Windows 2000 | Yes, with Service Pack 4 |
Windows NT 4.0 | No |
Windows 98 | No |
Script Code
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
}
}
For online peer support, join the microsoft.public.windows.server.scripting community on the msnews.microsoft.com news server. To provide feedback or report bugs in sample scripts or the Scripting Guide, please contact Microsoft TechNet.
Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.