Highlighted
Enthusiast
Enthusiast

Finding all VM's with connected CD-ROM's

Jump to solution

Guys,

I want to generate a report which will find any VM's which have any attached CD-ROM devices. I have created the following script

Get-VM | where{$_.ConnectionState -eq "True"} | Select Name | Export-Csv "C:\HealthCheck\SJDC\SJDC-ConnetedCD.csv" -NoTypeInformation

It generates the CSV file all right but its always empty. I made sure one of my VM's had an ISO image mounted and tried the script again, same result. Anyone know where I'm going wrong?

Thanks.

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Enthusiast
Enthusiast

missing a parameter in there,try the below:

get-vm | where { $_ | Get-CDDrive | where { $_.ConnectionState.Connected -eq "true"}} | Select name | Export-Csv "C:\HealthCheck\SJDC\SJDC-ConnetedCD.csv" -NoTypeInformation

View solution in original post

0 Kudos
1 Reply
Highlighted
Enthusiast
Enthusiast

missing a parameter in there,try the below:

get-vm | where { $_ | Get-CDDrive | where { $_.ConnectionState.Connected -eq "true"}} | Select name | Export-Csv "C:\HealthCheck\SJDC\SJDC-ConnetedCD.csv" -NoTypeInformation

View solution in original post

0 Kudos