Works great! As a side note for anyone else seeing this, I added a check to only hit the Windows boxes because the Linux ones don't need / can't use it, and on the reverse, when disconnecting them all, wants you to answer a question before proceeding. (And for my needs, I don't need to do that or work around it.)
Get-Cluster "clustername" | Get-VM | Where {$_.Guest -match 'windows'} | ForEach {Get-CDDrive -VM $_ | Set-CDDrive -IsoPath "[OverlyLongDatastorePath] ISO/updates.iso" -Connected $true -confirm:$false}
Get-Cluster "clustername" | Get-VM | Where {$_.Guest -match 'windows'} | ForEach {Get-CDDrive -VM $_ | Set-CDDrive -NoMedia -Connected $false -confirm:$false }
Original Message:
Sent: Feb 18, 2025 12:25 AM
From: LucD
Subject: Missing something mapping all VMs to an ISO
You will have to a Get-CDDrive first
Get-Cluster "clustername" | Get-VM | ForEach-Object -Process { Get-CDDrive -VM $_ | Set-CDDrive -IsoPath "[OverlyLongDSName] ISO/updates.iso" -Connected $true}
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Feb 17, 2025 04:26 PM
From: rblake
Subject: Missing something mapping all VMs to an ISO
My one-liner:
Get-Cluster "clustername" | Get-VM | ForEach {Set-CDDrive -VM $_ -IsoPath "[OverlyLongDSName] ISO/updates.iso" -Connected $true}
Complains that:
Line |
2 | Get-Cluster "clustername" | Get-VM | ForEach {Set-CDDrive -VM $_ -IsoPath …
| ~~~
| A parameter cannot be found that matches parameter name 'VM'.
I feel like this is something simple that I'm missing, but what is it?