-
MikeLeone
- Enthusiast
- Posts: 29
- Liked: 2 times
- Joined: Sep 21, 2022 3:03 pm
- Full Name: Michael Leone
- Contact:
Get list of all tapes currently in library (slots and drives)
I need to write a report about tapes that currently in my library that are FULL. This command, unfortunately, is monumentally slow:
$TapesToBeEjected = Get-VBRTapeMedium -Library $LibraryName | Where {{$_.IsFull -eq $TRUE}} | Select Name, LastWriteTime, MediaPoolID, IsFull, Location | Sort -Property MediaPoolID, Name
So rather than querying the all the tapes (I have over 1300), I figure it will be faster to just query the library for the tapes currently in the slots and drives (that will be about 80). Then I can do the $_.IsFull on just those.
But I am not seeing a command that seems to do that. Is there one, that queries the library and returns tapes in slots and drives?
Otherwise I would have to loop though Get-VBRTapeMedium -Library $LibraryName , select only $_.Location = Slot or Drive, and then re-select for $_.IsFull.
And I don't think that would be materially faster.
Is there a better way to get the info I need?
$TapesToBeEjected = Get-VBRTapeMedium -Library $LibraryName | Where {{$_.IsFull -eq $TRUE}} | Select Name, LastWriteTime, MediaPoolID, IsFull, Location | Sort -Property MediaPoolID, Name
So rather than querying the all the tapes (I have over 1300), I figure it will be faster to just query the library for the tapes currently in the slots and drives (that will be about 80). Then I can do the $_.IsFull on just those.
But I am not seeing a command that seems to do that. Is there one, that queries the library and returns tapes in slots and drives?
Otherwise I would have to loop though Get-VBRTapeMedium -Library $LibraryName , select only $_.Location = Slot or Drive, and then re-select for $_.IsFull.
And I don't think that would be materially faster.
Is there a better way to get the info I need?
-
david.domask
- Veeam Software
- Posts: 3180
- Liked: 736 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Get list of all tapes currently in library (slots and drives)
Hi MikeLeone,
When you say monumentally slow, can you give a time value for this? Please show the output of:
Potentially, you could parse through media pools with Get-VBRTapeMediaPool and pull out IsFull from that, but depending on the number of tapes in each media pool that may be slow as well.
Basically, I suspect we may need a case to review the behavior here but would be curious at first to understand how slow is "slow".
Similarly, I'm curious if it works better without the Select / Sort in the same line -- Select will build a PSCustomObject for each item piped to it, and I suspect that this may be the cause of the long-running command, and breaking the pipeline up into separate lines may help.
When you say monumentally slow, can you give a time value for this? Please show the output of:
Code: Select all
Measure-Command -Expression {Get-VBRTapeMedium}
Measure-Command -Expression {Get-VBRTapeMedium -Library $LibraryName | Where {{$_.IsFull -eq $TRUE}} | Select Name, LastWriteTime, MediaPoolID, IsFull, Location | Sort -Property MediaPoolID, Name}
(Get-VBRTapeMedium -Library $LibraryName | Where {{$_.IsFull -eq $TRUE}}).Count
Basically, I suspect we may need a case to review the behavior here but would be curious at first to understand how slow is "slow".
Similarly, I'm curious if it works better without the Select / Sort in the same line -- Select will build a PSCustomObject for each item piped to it, and I suspect that this may be the cause of the long-running command, and breaking the pipeline up into separate lines may help.
David Domask | Product Management: Principal Analyst
-
MikeLeone
- Enthusiast
- Posts: 29
- Liked: 2 times
- Joined: Sep 21, 2022 3:03 pm
- Full Name: Michael Leone
- Contact:
Re: Get list of all tapes currently in library (slots and drives)
I was mistaken, the slowness comes from this command:
$TapeMediaPool = Get-VBRTapeMediaPool -Library $LibraryName -ID $TapeMediaPoolID | Select -ExpandProperty Name
For example, the latest run of the program found 6 tapes to match. It took over 2 hours to match 6 tapes by TapeMediaPoolIID ..
Execution Time: 02:02:37.5152598 Script Run Date: 01/01/2026 08:03:52
I will re-run the script, with Write-Verbose showing various start times, and post the code here later.
$TapeMediaPool = Get-VBRTapeMediaPool -Library $LibraryName -ID $TapeMediaPoolID | Select -ExpandProperty Name
For example, the latest run of the program found 6 tapes to match. It took over 2 hours to match 6 tapes by TapeMediaPoolIID ..
Execution Time: 02:02:37.5152598 Script Run Date: 01/01/2026 08:03:52
I will re-run the script, with Write-Verbose showing various start times, and post the code here later.
-
david.domask
- Veeam Software
- Posts: 3180
- Liked: 736 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Get list of all tapes currently in library (slots and drives)
Thanks for the update, Get-VBRTapeMediaPool makes a bit more sense to me as the returned object will have all of the tapes added to the media pool as part of the returned object under the Medium property, so I'm guessing building the object is what takes awhile -- for the media pool you tested with, how many tapes are added to the media pool?
Will discuss internally on how we can improve performance for Get-VBRTapeMediaPool, but for your scripting needs, use Get-VBRTapeMedium and consider filtering first on the Location.Type property and only pull tapes in slot / drive -- it should be much faster.
Will discuss internally on how we can improve performance for Get-VBRTapeMediaPool, but for your scripting needs, use Get-VBRTapeMedium and consider filtering first on the Location.Type property and only pull tapes in slot / drive -- it should be much faster.
David Domask | Product Management: Principal Analyst
-
MikeLeone
- Enthusiast
- Posts: 29
- Liked: 2 times
- Joined: Sep 21, 2022 3:03 pm
- Full Name: Michael Leone
- Contact:
Re: Get list of all tapes currently in library (slots and drives)
I have these pools: (I will add the totals in the pools by hand, since I can't take the time to wait for a new script to pull them out ..)
PS P:\software\PHA Scripts> Get-VBRTapeLibrary | Get-VBRTapeMediaPool | Select Name, Id Name Id ---- --
PHACLONE 747
Free 7
Imported
PROD-DMZ 6
PROD-SCADA 3
Retired 1
PROD-FileServer INCREMENTAL 0
PROD-Telecom 9
PROD-Scanning 20
PROD-APP and WEB Servers 21
Media Pool 1 7
DEV-DBs and Log Shipping 65
DEV-FileServer Related 8
PROD-Mail Related 175
DEV-App and Web Servers 26
Unrecognized 1
PROD-FileServer Related 117
PROD-DBs and Log Shipping 58
PROD-FileServer FULL 48
PROD-Networking Management 38
Here are the tapes I was looking up. there are 5 ...
1. 018139L7 12/30/2025 14:28:10 PHACLONE
2. 018196L7 12/30/2025 06:51:05 PHACLONE
3. 018197L7 12/30/2025 05:08:46 PROD-DBs and Log Shipping
4. 018210L7 12/29/2025 16:32:31 PROD-FileServer Related
5. 018208L7 12/30/2025 12:14:57 PROD-Mail Related
PS P:\software\PHA Scripts> Get-VBRTapeLibrary | Get-VBRTapeMediaPool | Select Name, Id Name Id ---- --
PHACLONE 747
Free 7
Imported
PROD-DMZ 6
PROD-SCADA 3
Retired 1
PROD-FileServer INCREMENTAL 0
PROD-Telecom 9
PROD-Scanning 20
PROD-APP and WEB Servers 21
Media Pool 1 7
DEV-DBs and Log Shipping 65
DEV-FileServer Related 8
PROD-Mail Related 175
DEV-App and Web Servers 26
Unrecognized 1
PROD-FileServer Related 117
PROD-DBs and Log Shipping 58
PROD-FileServer FULL 48
PROD-Networking Management 38
Here are the tapes I was looking up. there are 5 ...
1. 018139L7 12/30/2025 14:28:10 PHACLONE
2. 018196L7 12/30/2025 06:51:05 PHACLONE
3. 018197L7 12/30/2025 05:08:46 PROD-DBs and Log Shipping
4. 018210L7 12/29/2025 16:32:31 PROD-FileServer Related
5. 018208L7 12/30/2025 12:14:57 PROD-Mail Related
-
MikeLeone
- Enthusiast
- Posts: 29
- Liked: 2 times
- Joined: Sep 21, 2022 3:03 pm
- Full Name: Michael Leone
- Contact:
Re: Get list of all tapes currently in library (slots and drives)
I rebooted the Veeam server, and the speed increased significantly. From 2 hours+ to 8 minutes ...
PS P:\software\PHA Scripts> .\Mail-List-of-FULL-Tapes-in-Veeam-Library-V2.PS1
WARNING: The names of some imported commands from the module 'Veeam.Backup.PowerShell' include unapproved verbs that might make them less discoverable. To find
the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
VERBOSE:
VERBOSE: Script: P:\software\PHA Scripts\Mail-List-of-FULL-Tapes-in-Veeam-Library-V2.PS1
VERBOSE: StartTime: 01/02/2026 12:47:44
VERBOSE:
VERBOSE: Connect to VBR Server: DCTRBCK001.wrk.ads.pha.phila.gov
VERBOSE:
VERBOSE: Connected! Now onto selecting (with new criteria) ...
VERBOSE:
VERBOSE: Library: QUANTUM Scalar i3-i6 282G
VERBOSE:
VERBOSE: Executing SEARCH for FULL tapes in SLOTS and DRIVES
VERBOSE:
Name LastWriteTime MediaPoolId IsFull Location
---- ------------- ----------- ------ --------
018139L7 12/30/2025 2:28:10 PM 122dacee-1b36-4047-8841-0a68bfb529f5 True Slot
018196L7 12/30/2025 6:51:05 AM 122dacee-1b36-4047-8841-0a68bfb529f5 True Slot
018202L7 1/1/2026 5:43:16 PM 25e78806-66dc-4934-a9d3-cd700f229fb5 True Slot
018197L7 12/30/2025 5:08:46 AM 835e64ef-b485-4920-b615-baaafb537f3f True Slot
018210L7 12/29/2025 4:32:31 PM 8f01c29f-a46c-467b-88d3-abbc3492716d True Slot
018208L7 12/30/2025 12:14:57 PM e523dcd2-93cf-4638-a6b2-811c3cee791e True Slot
018211L7 1/1/2026 1:48:23 AM e523dcd2-93cf-4638-a6b2-811c3cee791e True Slot
VERBOSE: TapesToBeEjected.Count = 7
VERBOSE:
VERBOSE: Starting to loop through, and format the output
VERBOSE:
VERBOSE: Loop Start Time: 01/02/2026 12:48:32
VERBOSE:
VERBOSE: Volume Time Last Written Pool Full Location
VERBOSE: ----------------------------------------------------------
VERBOSE: Getting tape media pool ID 122dacee-1b36-4047-8841-0a68bfb529f5 - 01/02/2026 12:48:32
VERBOSE: Found tape media pool ID 122dacee-1b36-4047-8841-0a68bfb529f5 - Pool: PHACLONE . Executoiopn time of the lookup 00:01:00.8820387
VERBOSE: 1. 018139L7 12/30/2025 14:28:10 PHACLONE
VERBOSE: Getting tape media pool ID 122dacee-1b36-4047-8841-0a68bfb529f5 - 01/02/2026 12:49:33
VERBOSE: Found tape media pool ID 122dacee-1b36-4047-8841-0a68bfb529f5 - Pool: PHACLONE . Executoiopn time of the lookup 00:01:01.3723027
VERBOSE: 2. 018196L7 12/30/2025 06:51:05 PHACLONE
VERBOSE: Getting tape media pool ID 25e78806-66dc-4934-a9d3-cd700f229fb5 - 01/02/2026 12:50:35
VERBOSE: Found tape media pool ID 25e78806-66dc-4934-a9d3-cd700f229fb5 - Pool: PROD-FileServer FULL . Executoiopn time of the lookup 00:01:13.6698070
VERBOSE: 3. 018202L7 01/01/2026 17:43:16 PROD-FileServer FULL
VERBOSE: Getting tape media pool ID 835e64ef-b485-4920-b615-baaafb537f3f - 01/02/2026 12:51:48
VERBOSE: Found tape media pool ID 835e64ef-b485-4920-b615-baaafb537f3f - Pool: PROD-DBs and Log Shipping . Executoiopn time of the lookup 00:01:14.0651456
VERBOSE: 4. 018197L7 12/30/2025 05:08:46 PROD-DBs and Log Shipping
VERBOSE: Getting tape media pool ID 8f01c29f-a46c-467b-88d3-abbc3492716d - 01/02/2026 12:53:02
VERBOSE: Found tape media pool ID 8f01c29f-a46c-467b-88d3-abbc3492716d - Pool: PROD-FileServer Related . Executoiopn time of the lookup 00:01:14.7233494
VERBOSE: 5. 018210L7 12/29/2025 16:32:31 PROD-FileServer Related
VERBOSE: Getting tape media pool ID e523dcd2-93cf-4638-a6b2-811c3cee791e - 01/02/2026 12:54:17
VERBOSE: Found tape media pool ID e523dcd2-93cf-4638-a6b2-811c3cee791e - Pool: PROD-Mail Related . Executoiopn time of the lookup 00:01:10.9135272
VERBOSE: 6. 018208L7 12/30/2025 12:14:57 PROD-Mail Related
VERBOSE: Getting tape media pool ID e523dcd2-93cf-4638-a6b2-811c3cee791e - 01/02/2026 12:55:28
VERBOSE: Found tape media pool ID e523dcd2-93cf-4638-a6b2-811c3cee791e - Pool: PROD-Mail Related . Executoiopn time of the lookup 00:01:09.0788398
VERBOSE: 7. 018211L7 01/01/2026 01:48:23 PROD-Mail Related
VERBOSE:
VERBOSE: Loop End Time: 01/02/2026 12:56:37
VERBOSE: Loop Executionn Time: 00:08:04.7385334
VERBOSE:
VERBOSE: Script Ending: 01/02/2026 12:56:37
VERBOSE: Script run time: 00:08:53.1437284
VERBOSE:
VERBOSE:
VERBOSE: Here are a list of tapes that are marked FULL in Veeam, that need to go offsite 2026-01-02
P:\software\PHA Scripts\Mail-List-of-FULL-Tapes-in-Veeam-Library-V2.PS1 run from host: HQISMWVM001
Veeam List of tapes to be sent offsite.
Execution Time: 00:08:53.1437284 Script Run Date: 01/02/2026 12:56:37
VERBOSE:
PS P:\software\PHA Scripts> .\Mail-List-of-FULL-Tapes-in-Veeam-Library-V2.PS1
WARNING: The names of some imported commands from the module 'Veeam.Backup.PowerShell' include unapproved verbs that might make them less discoverable. To find
the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
VERBOSE:
VERBOSE: Script: P:\software\PHA Scripts\Mail-List-of-FULL-Tapes-in-Veeam-Library-V2.PS1
VERBOSE: StartTime: 01/02/2026 12:47:44
VERBOSE:
VERBOSE: Connect to VBR Server: DCTRBCK001.wrk.ads.pha.phila.gov
VERBOSE:
VERBOSE: Connected! Now onto selecting (with new criteria) ...
VERBOSE:
VERBOSE: Library: QUANTUM Scalar i3-i6 282G
VERBOSE:
VERBOSE: Executing SEARCH for FULL tapes in SLOTS and DRIVES
VERBOSE:
Name LastWriteTime MediaPoolId IsFull Location
---- ------------- ----------- ------ --------
018139L7 12/30/2025 2:28:10 PM 122dacee-1b36-4047-8841-0a68bfb529f5 True Slot
018196L7 12/30/2025 6:51:05 AM 122dacee-1b36-4047-8841-0a68bfb529f5 True Slot
018202L7 1/1/2026 5:43:16 PM 25e78806-66dc-4934-a9d3-cd700f229fb5 True Slot
018197L7 12/30/2025 5:08:46 AM 835e64ef-b485-4920-b615-baaafb537f3f True Slot
018210L7 12/29/2025 4:32:31 PM 8f01c29f-a46c-467b-88d3-abbc3492716d True Slot
018208L7 12/30/2025 12:14:57 PM e523dcd2-93cf-4638-a6b2-811c3cee791e True Slot
018211L7 1/1/2026 1:48:23 AM e523dcd2-93cf-4638-a6b2-811c3cee791e True Slot
VERBOSE: TapesToBeEjected.Count = 7
VERBOSE:
VERBOSE: Starting to loop through, and format the output
VERBOSE:
VERBOSE: Loop Start Time: 01/02/2026 12:48:32
VERBOSE:
VERBOSE: Volume Time Last Written Pool Full Location
VERBOSE: ----------------------------------------------------------
VERBOSE: Getting tape media pool ID 122dacee-1b36-4047-8841-0a68bfb529f5 - 01/02/2026 12:48:32
VERBOSE: Found tape media pool ID 122dacee-1b36-4047-8841-0a68bfb529f5 - Pool: PHACLONE . Executoiopn time of the lookup 00:01:00.8820387
VERBOSE: 1. 018139L7 12/30/2025 14:28:10 PHACLONE
VERBOSE: Getting tape media pool ID 122dacee-1b36-4047-8841-0a68bfb529f5 - 01/02/2026 12:49:33
VERBOSE: Found tape media pool ID 122dacee-1b36-4047-8841-0a68bfb529f5 - Pool: PHACLONE . Executoiopn time of the lookup 00:01:01.3723027
VERBOSE: 2. 018196L7 12/30/2025 06:51:05 PHACLONE
VERBOSE: Getting tape media pool ID 25e78806-66dc-4934-a9d3-cd700f229fb5 - 01/02/2026 12:50:35
VERBOSE: Found tape media pool ID 25e78806-66dc-4934-a9d3-cd700f229fb5 - Pool: PROD-FileServer FULL . Executoiopn time of the lookup 00:01:13.6698070
VERBOSE: 3. 018202L7 01/01/2026 17:43:16 PROD-FileServer FULL
VERBOSE: Getting tape media pool ID 835e64ef-b485-4920-b615-baaafb537f3f - 01/02/2026 12:51:48
VERBOSE: Found tape media pool ID 835e64ef-b485-4920-b615-baaafb537f3f - Pool: PROD-DBs and Log Shipping . Executoiopn time of the lookup 00:01:14.0651456
VERBOSE: 4. 018197L7 12/30/2025 05:08:46 PROD-DBs and Log Shipping
VERBOSE: Getting tape media pool ID 8f01c29f-a46c-467b-88d3-abbc3492716d - 01/02/2026 12:53:02
VERBOSE: Found tape media pool ID 8f01c29f-a46c-467b-88d3-abbc3492716d - Pool: PROD-FileServer Related . Executoiopn time of the lookup 00:01:14.7233494
VERBOSE: 5. 018210L7 12/29/2025 16:32:31 PROD-FileServer Related
VERBOSE: Getting tape media pool ID e523dcd2-93cf-4638-a6b2-811c3cee791e - 01/02/2026 12:54:17
VERBOSE: Found tape media pool ID e523dcd2-93cf-4638-a6b2-811c3cee791e - Pool: PROD-Mail Related . Executoiopn time of the lookup 00:01:10.9135272
VERBOSE: 6. 018208L7 12/30/2025 12:14:57 PROD-Mail Related
VERBOSE: Getting tape media pool ID e523dcd2-93cf-4638-a6b2-811c3cee791e - 01/02/2026 12:55:28
VERBOSE: Found tape media pool ID e523dcd2-93cf-4638-a6b2-811c3cee791e - Pool: PROD-Mail Related . Executoiopn time of the lookup 00:01:09.0788398
VERBOSE: 7. 018211L7 01/01/2026 01:48:23 PROD-Mail Related
VERBOSE:
VERBOSE: Loop End Time: 01/02/2026 12:56:37
VERBOSE: Loop Executionn Time: 00:08:04.7385334
VERBOSE:
VERBOSE: Script Ending: 01/02/2026 12:56:37
VERBOSE: Script run time: 00:08:53.1437284
VERBOSE:
VERBOSE:
VERBOSE: Here are a list of tapes that are marked FULL in Veeam, that need to go offsite 2026-01-02
P:\software\PHA Scripts\Mail-List-of-FULL-Tapes-in-Veeam-Library-V2.PS1 run from host: HQISMWVM001
Veeam List of tapes to be sent offsite.
Execution Time: 00:08:53.1437284 Script Run Date: 01/02/2026 12:56:37
VERBOSE:
Who is online
Users browsing this forum: No registered users and 64 guests