Hello,
I'm trying to mount ISO file in multiple VM that is stored in one of my datastore using the below scripts. However, I'm getting error while doing so. Can I get an expert opinion on this? I've mentioned d the below script that I'm using.
#Scripts
$VMs = (Get-Content servers.txt)
$ds = (Read-Host "Type the datastore name:")
$ISO_Path = (Read-Host "Type the path to the ISO file:")
foreach($vm in $VMs){
Get-CDDrive $vm | Set-CDDrive -StartConnected:$true -Connected:$true -IsoPath [$ds] $ISO_Path -Confirm:$false
}
#Error
Set-CDDrive : Cannot bind parameter 'CD'. Cannot convert the "VMware-Tools-2.2.0.iso" value of type "System.String" to
type "VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.CDDrive".
At D:\KoushikNew\Windows\VMware Tools\vmtoolmnt.ps1:6 char:86
+ ... tartConnected:$true -Connected:$true -IsoPath [$ds] $ISO_Path -Confir ...
+ ~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-CDDrive], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevic
e.SetCDDrive