dynamic menu

hello
i want to create a dynamic menu from a script like
$index = 1
$computers=“cmp1”,“cmp2”

$computers | foreach {
$computer = $_
Get-WMIObject Win32_Logicaldisk -ComputerName $_ | where{$_.deviceid -match “C|E”} | select @{ Name = “ID” ; Expression={ (([ref]$index).Value++) }},pscomputername,DeviceID,FreeSpace
}
the result is like that
ID PSComputerName DeviceID FreeSpace


1 cmp1 C: 68276293632
2 cmp1 E: 17085005824
3 cmp2 C: 68276293632
4 cmp2 E: 17085005824

then i want the user make a choice based on the result like
$input=read-host “enter a choice 1 to 4”
if ($input -eq “1”){
copy-item c:\folder1 -destination \valuePScomputername[line1]\valueDeviceID[line1]
}
do i need to create a custom object to do this or is there another way…
thank you

This should work. Only you need to get the copy statement in, but the logic is there.

$userinput=read-host "enter a choice 1 to " $computer.count
 if ( $userinput -le $computer.count){
    $computer[$userinput -1]
    }