PowerCLI CDROM’s disconnect and reconnect

In powershell it’s really easy to disconnect and reconnect cdrom drives:

To see all connected drives:

Get-VM | where {($_ | Get-CDDrive).ISOPath -ne $null}  |FT Name, @{Label="ISO file"; Expression = { ($_ | Get-CDDrive).ISOPath }}

To auto disconnect all:

Get-VM | Get-CDDrive | Where {$_.ConnectionState.Connected} | Set-CDDrive -Connected $false -Confirm:$false

2 Replies to “PowerCLI CDROM’s disconnect and reconnect”

Leave a Reply to Joseph Griffiths Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.