My problem is with the ISO PATH image. I get an error "Invalid data store format"
You specify isopath using a parameter IsoPath, which is the data store path to the ISO, and not just the ISO name. You do not specify any data storage from your code.
:
"[yourdatastore] IsoFolder\$iso"
PowerCLI :
$cd = New-CDDrive -VM $vm -ISOPath "[sof-20666-esx:storage1] ISO\testISO.iso"
Set-CDDrive -CD $cd -StartConnected -Connected