VMware Cloud Community
fborges555
Enthusiast
Enthusiast
Jump to solution

CD\dvd connected and mounted

HI

it seems like I always need help , I looking for a script that get me the information on what cd\dvd are mounted  within a esxi host.

get me the vm housed by the esxi host that have cd\dvd mounted

Thanks

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Do you mean something like this?

$esxName = 'MyEsx'

Get-VMHost -Name $esxName | Get-VM -PipelineVariable vm | Get-CDDrive |

where{$_.ConnectionState.Connected} |

select @{N='VM';E={$vm.Name}},IsoPath,HostDevice,RemoteDevice


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

Do you mean something like this?

$esxName = 'MyEsx'

Get-VMHost -Name $esxName | Get-VM -PipelineVariable vm | Get-CDDrive |

where{$_.ConnectionState.Connected} |

select @{N='VM';E={$vm.Name}},IsoPath,HostDevice,RemoteDevice


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

L.

as always thanks , can this be adjusted to change the status of the device type to "client Device" ?? and also if by any chance the vmware tools is running how to end installation ?

Thanks

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

That is done by the VMRC with an API that is afaik not public.

There is no PowerCLI cmdlet or method, but you could use Invoke-VMScript to check if a VMware Tools update is running inside the guest OS.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

L.

so at this point get-dcdrive can tell me if it is mount, but as of now there is no script that can dismount and change the device type to "client device", this portion has to be done manually?

correct?

Thanks again jefe

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

That is correct.

In fact, when you use the VMRC you can only connect to a local ISO when the VM is powered on.

The only way around is to copy the ISO to a datastore and then use the IsoPath parameter.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

L.

Thanks for the direction , as always priceless

for the CD\dvd I went and adjust the script to reflect " | set-cddrive -nomedia -confirm:$false"

sad we dont have something that will trigger or do "end VMware Tools Install"

pastedImage_0.png

again Thanks a bunch L for all the help

Reply
0 Kudos