- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi lucd
playing around with this varation
$result = @()
$luns = get-content luns.txt
foreach ($lun in $luns) {
$vms = get-vm -datastore $lun
foreach ($vm in $vms) {
$datastore = get-vm $vm | Get-Datastore
$obj = New-Object psobject
$obj | add-member -MemberType NoteProperty -Name VM_NAme -Value $vm.Name
$obj | Add-Member -MemberType NoteProperty -Name Datastore_NAme -Value $datastore.Name
$result += $obj
}
}
$result | ft -AutoSize
Can i use a single foreach loop to get this to work?