Question

I'm trying to find a way with PowerCLI to get a list of ISO's that are mounted in VM's and change the device type to "client device." Originally I thought that using the get-datastore would work to find the ISO's, however I was struggling to find ISO's, and ran into this line of code while doing some searching:

(Get-VM | Get-View | Where {$_.Runtime.ToolsInstallerMounted}) | % {$_.Name}

I tried this, however I didn't get a list of ISO's mounted. Was wondering if anyone here might know how to get a list of ISO's mounted on VM's and change the device type to client through scripting.

Was it helpful?

Solution

Try this, remove WhatIf to remove the ISO:

Get-VM | 
Get-CDDRive | 
Where-Object {$_.IsoPath} | 
Set-CDDrive -NoMedia -Confirm:$false -WhatIf
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top