Hi,
My problem:
After upgrading the vmware tools on Redhat Linux Guests the vmware tools remain in the vm properties.
I mean that the vm device: CD-Rom Drive is configured for the Datastore-ISO File [] /vmimages/tools-isoimages/linux.iso
The CD Rom drive is not connected!
I cannot Vmotion such systems.
Is there a way to set the clientcdrom device type to "clientdevice" via PowerCLI?
I checked some powercli commands: set-cddrive, dismount-tools
With the powerclie cmd:
get-vm GuestName | get-cddrive
I'm able to locate the systems who have the problem.
Output:
IsoPath HostDevice RemoteDevice
------- ---------- ------------
[] /vmimages/tool...
Via Vsphere Client I'm able to change the config from datastore iso to clientdevice.
and change the mode from emulate ide to pathtrough ide (recommended)
--> A smart solution would be to automate this 2 tasks via powercli.
2 Screenshots:
Has anyone automated this 2 tasks via powercli
Hi Georg,
I think that -NoMedia switch of Set-CDDrive is what you need - it will detach host device or iso file.
Get-VM <filters> | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$false
Regards,
Vitali
PowerCLI Team
Afaik, the vSphere client uses private APIs to mount client device ISOs.
There are no cmdlets nor SDK API methods that do this.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
Could i solve the problem recreating the cdrom?
first Remove-CDDrive
and then New-CDDrive ??
br
George
That could indeed solve the problem, provided the Remove-CDDrive works while there is still an ISO mounted.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
I tried to remove the cddrive.
get-cddrive -vm GuestVM | remove-cddrive -Confirm:$false
Remove-CDDrive : 03.03.2011 08:49:34 Remove-CDDrive The VM must be in the following state: PoweredOff.
At line:1 char:48
+ get-cddrive -vm guestVM | remove-cddrive <<<< -Confirm:$false
+ CategoryInfo : InvalidOperation: (PoweredOn:PowerState) [Remove-CDDrive], ViError
+ FullyQualifiedErrorId : Common_SharedParameterHelper_VerifyVmIsInState_VmNotInState,VMware.VimAutomation.ViCore.Cmdlets.Commands.RemoveCDDrive
Remove-CDDrive : 03.03.2011 08:49:34 Remove-CDDrive The VM must be in the following state: PoweredOff.
At line:1 char:48
The vm must be powered off to remove the vm.
Is there a way to remove the cdrom drive from a running vm?
br
Georg
Hi Georg,
I think that -NoMedia switch of Set-CDDrive is what you need - it will detach host device or iso file.
Get-VM <filters> | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$false
Regards,
Vitali
PowerCLI Team
Hi Vitali,
You solved my problem.
Perfect. Exact what i was searching for!!!!!
!!!! Thank you very much!!!!
br
Georg
looks like this scripts goes through every single vm weather cd mounted or not . hammering the envirnonment.
We need a script which only reconfigure the VMs which have drive mounted .
Get-VM <filters> | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$false
Hi,
You're right - the script goes through every single machine. You can filter the result with where cmdlet like this:
Get-VM <filters> | Get-CDDrive | where { $_.IsoPath -or $_.HostDevice -or $_.RemoteDevice } | Set-CDDrive -NoMedia -Confirm:$false
This where statement will filter only those CDDrive objects which are connected in one of the three possible ways.
Hope this helps.
Vitali
Hi,
I read this thread and as I'm wondering there is any way to list all VMs with Emulated IDE on CD-ROM ?
With this option my SDRS cluster can't balance VMs and I need to list all these VMs with this settings.
There is what I did actually to detect it :
$VMs=Get-VM$resultat=@()foreach ($x in $VMs) {if ( (Get-CDDrive $x).ExtensionData.DeviceInfo.Summary -match "Remote") {$resultat+=$x.name}}$resultat | Out-File C:\scripts\cdrom.txtThanks for your help.
Hello.
yes it is possible:
$a=get-vm name1
$a.extensiondata.config.hardware.device[-2].backing.gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False VirtualCdromRemoteAtapiBackingInfo VMware.Vim.VirtualDeviceRemoteDeviceBackingInfo
VirtualCdromRemoteAtapiBackingInfo -> this is for emulate
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False VirtualCdromRemotePassthroughBackingInfo VMware.Vim.VirtualDeviceRemoteDeviceBackingInfo
VirtualCdromRemotePassthroughBackingInfo this is for passthrough
I don;t have time now to write you the enumerate script for vms.
idea: get vm, get cdrom dev id, query the .devices by .Key -eq 'id' and check the backing type and then you can do the rest.
Let me know if this is enough or you want me to write more later.
you can always join channel #powercli on freenode irc network if you want real time help i can help you out during my breaks if you want
greg
Oh great I will try this ! Thanks !
This is working...
thanks so much...
i found if there are so many iso mounted it will not auto connected to the server.
get-vm xxxxxx |Get-CDDrive|Where-Object {$_.IsoPath -or $_.HostDevice -or $_.RemoteDevice } |Set-CDDrive -NoMedia -Confirm:$false