0

I assume this would be easy. However i cannot get powercli latest to mount a cd with an iso and boot from the ISO to install the OS(windows).

    $NewVMParams = @{
    'VMHost' = 'MyESX1'
    'Name' = 'TestMount_Auto'
    'Datastore' = 'VMFSLun01'
    'DiskGB' = 20
    'DiskStorageFormat' = 'Thin'
    'MemoryGB' = 4
    'GuestId' = 'windows8Server64Guest'
    'Version' = 'v10'
    'NumCpu' = 2
    'Notes' = 'Mike Dopp is breaking things'
}
$VM = New-VM @NewVMParams

$NewCDDriveParams = @{
    'VM' = $VM
    'IsoPath' = '[VMFSLUN01] ISO\SW_DVD5_Windows_Svr_Std_and_DataCtr_2012_R2_64Bit_English_Core_MLF_X19-05182.iso'
    'ErrorAction' = 'Stop'
    'StartConnected' = $True
}
New-CDDrive @NewCDDriveParams

Start-VM -VM $VM

Get-CDDrive -VM $VM | Set-CDDrive -connected 1

I typically get this error:

Set-CDDrive : 1/9/2018 11:19:53 AM      Set-CDDrive             The operation for the entity "TestMount_Auto" failed with the following message: "Connection control operation failed for disk 'ide0:0' (201).". Connection
control operation failed for disk 'ide0:0' (201).
At line:1 char:23
+ Get-CDDrive -VM $VM | Set-CDDrive -connected 1
+                       ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-CDDrive], GenericVmConfigFault
    + FullyQualifiedErrorId : Client20_TaskServiceImpl_CheckServerSideTaskUpdates_OperationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.SetCDDrive

Ideas? i am stumped at the moment. thanks in advance.

***Update. Fixed the issue with Set-CDDrive -connected 1 there is no cdrom 1 it is 0 instead.

Also need to force the bios to wait 5 seconds to boot after repointing the ISo mount to the DataStore to get this to work. Still too manual.

***Update2 Found the issue.

$NewVMParams = @{
   'VMHost' = 'YourVMHost'
   'Name' = 'RickAstley'
   'Datastore' = 'YourDataStoreLUN01'
   'DiskGB' = 20
   'DiskStorageFormat' = 'Thin'
   'MemoryGB' = 4
   'GuestId' = 'windows8Server64Guest'
   'Version' = 'v10'
   'NumCpu' = 2
   'Notes' = 'Mike Dopp is breaking things'
    }
   $VM = New-VM @NewVMParams

   $NewCDDriveParams = @{
     'VM' = $VM
     'IsoPath' = '[YourDataStoreLUN01] ISO\TOODAMNBIG.iso'
     'StartConnected' = $true
     }
   New-CDDrive @NewCDDriveParams
    Sleep 10s
  Start-VM -VM $VM

found in the old code I was pointing to a long string name .ISO so I changed the name to: TOODAMNBIG.iso This allowed Vsphere time to find the name. So lower case .iso is what Vsphere wants passed to mount an iso to the cdrom. SOLVED!

mikedopp
  • 229
  • 2
  • 7
  • 16

0 Answers0