cancel
Showing results for 
Search instead for 
Did you mean: 

BEMCLI: Get-BERoboticLibrarySlot | Get-BEMedia not working

Frankklin
Level 2

Hi,

I am trying to get tape information about the current tapes in the library:-

Get-BERoboticLibrarySlot -RoboticLibraryDevice "robotic library 0001" | Where-Object {($_.Barcode -ne "" )} | get-BEmedia -id $_.MediaID

and get:-

Get-BEMedia : Cannot validate argument on parameter 'Id'. The argument is null or empty. Supply an argument that is not null or empty and t
hen try the command again.
At line:1 char:126
+ Get-BERoboticLibrarySlot -RoboticLibraryDevice "robotic library 0001" | Where-Object {($_.Barcode -ne "" )} | get-BEmedia -id <<<<  $_.Me
diaID
    + CategoryInfo          : InvalidData: (:) [Get-BEMedia], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,BackupExec.Management.CLI.Commands.GetBEMediaCommand

doing this in steps:-

$fullslot = Get-BERoboticLibrarySlot -RoboticLibraryDevice "robotic library 0001" | Where-Object {($_.Barcode -ne "" )}

Name       SlotNumber IsCleaningSlot  Media
----       ---------- --------------  -----
Slot 23    23         False           LU0992L5
Slot 24    24         False           LU0517L5
Slot 25    25         False           LU0528L5
Slot 26    26         False           LU0988L5
Slot 27    27         False           LU0991L5
Slot 29    29         False           LU0525L5
Slot 31    31         False           LU0990L5
Slot 32    32         False           LU0515L5
Slot 33    33         False           LU0522L5
Slot 34    34         False           LU0994L5
Slot 35    35         False           LU0993L5
Slot 43    43         False           LU0845L5
Slot 44    44         False           LU0867L5

BEMCLI> $tapeguid = $fullslot | select mediaid
BEMCLI> $tapeguid

MediaId
-------
a5810f69-040e-45d6-9466-38a48c945f63
3b59a0bb-06bd-457d-8f2d-e57b45d3b206
146be13c-566e-4320-8cb8-517df9f237fd
d50efee5-c12d-4828-81db-b0f740d0427b
b5eb0f7d-35bf-4f25-8c48-4324c8fe3b44
33b46fc8-c74a-427b-9304-64cb04f81993
1ebb600a-5410-4c42-a02a-10ce167951c9
a8c72f2d-ef75-4271-a7c8-4655da9986f2
af87b760-422d-437f-83fa-5e37dad469b8
703991c5-4283-4efc-995b-0424166643a5
8fd31f24-3d48-41b9-a01c-fb8fc3fd824a
f81ec48f-67fc-4f9c-825c-1b0a5ea6e72b
adba8929-ac2a-4ef2-91d0-500d18262db8

Even tried renaming parameter to match what is expected

BEMCLI> $tapeid = $tapeguid | select @{Name="Id";Expression={$_.MediaId}}
BEMCLI> $tapeid

Id
--
a5810f69-040e-45d6-9466-38a48c945f63
3b59a0bb-06bd-457d-8f2d-e57b45d3b206
146be13c-566e-4320-8cb8-517df9f237fd
d50efee5-c12d-4828-81db-b0f740d0427b
b5eb0f7d-35bf-4f25-8c48-4324c8fe3b44
33b46fc8-c74a-427b-9304-64cb04f81993
1ebb600a-5410-4c42-a02a-10ce167951c9
a8c72f2d-ef75-4271-a7c8-4655da9986f2
af87b760-422d-437f-83fa-5e37dad469b8
703991c5-4283-4efc-995b-0424166643a5
8fd31f24-3d48-41b9-a01c-fb8fc3fd824a
f81ec48f-67fc-4f9c-825c-1b0a5ea6e72b
adba8929-ac2a-4ef2-91d0-500d18262db8

 

 

 

2 REPLIES 2

pkh
Moderator
Moderator
   VIP    Certified
After the Where-Object cmdlet, what you have is an array of object. You cannot feed this straight into the Get_BEMedia cmdlet. You got to set up a loop to process the individual objects

BE_KirkFreiheit
Level 4
Employee

Hi Frankklin,

The "Media" property of the BERoboticLibrarySlot is actually a full BEMedia object -- not just its label.  So, for this scenario, you'll want to use "Select-Object" to pick off the BEMedia objects from the slots:

Get-BERoboticLibrarySlot -RoboticLibraryDevice "robotic library 0001" | Select-Object -Expand Media

This is often the case with BEMCLI: we embed the subobjects directly, rather than just putting keys/names that make you issue another command to fetch the related objects.

Hope this helps!

-Kirk out.

 

Note: I use "-Expand" so Select-Object returns just the raw, full BEMedia objects.  Without that, it returns a wrapped object; it's subtle, but "-Expand" is something I use often with Select-Object.  Experiment with/without that switch to see what happens.  Its behavior seems to have changed a bit between PowerShell v2 and v3.