I thought I had this right, but apparently not.
It's my understanding that when selecting multiple attributes of a cmdlet's
output it creates an array. Yet it's not working.
$eject_tapes = $null
$all_tapes = Get-ProtectionGroup -DPMServer SD-SCDPM-01 | Get-Tape | Select
Label, Barcode, Location | Sort-Object Label | ft -autosize
foreach ($tape in $all_tapes)
{
if ($tape.label -like "*monthly*" -and $tape.location -ne "offline")
{
$eject_tapes = $tape.location
}
}
out-file -filepath "c:\users\danielcadmin\documents\tapes.txt" -inputobject
$eject_tapes
Output file is empty and shouldn't be. Doing this manually I see it's not
picking up that I want the element. I've also tried $tape.[0] without joy. This
is part of a larger project BTW.
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1