this is what I have so far:
Get-VM | Sort | % {
$vm = $_
$out = "" | Select VmName, CdRomStatus, IsoFile
$out.VmName = $vm.Name
$vm.CDDrives | where {$_.ConnectionState.Connected -or $_.IsoPath -ne $null} | % {
$out.Connected = $_.ConnectionState.Connected
$out.IsoFile = $_.IsoPath
$report += $out
}
}
Thanks
That should do it:
Get-VM | Sort | % { $vm = $_ $out = "" | Select VmName, CdRomStatus, IsoFile, StartConnected $out.VmName = $vm.Name $cds = $vm.CDDrives $vm.CDDrives | where {$_.ConnectionState.Connected -or $_.IsoPath -ne $null -or $_.StartConnected} | % { $out.Connected = $_.ConnectionState.Connected $out.IsoFile = $_.IsoPath $out.StartConnected = $_.StartConnected $report += $out } }
======================================
Chyna Trople, VCP
Monitor. Correlate. Act. | vWire.com
That should do it:
Get-VM | Sort | % { $vm = $_ $out = "" | Select VmName, CdRomStatus, IsoFile, StartConnected $out.VmName = $vm.Name $cds = $vm.CDDrives $vm.CDDrives | where {$_.ConnectionState.Connected -or $_.IsoPath -ne $null -or $_.StartConnected} | % { $out.Connected = $_.ConnectionState.Connected $out.IsoFile = $_.IsoPath $out.StartConnected = $_.StartConnected $report += $out } }
======================================
Chyna Trople, VCP
Monitor. Correlate. Act. | vWire.com
Thanks fro your help.
It actually worked when I appended $._ConnectionState to .StartConnected
$_.ConnectionState.StartConnected
No problem...thanks again for your help.