VMware Cloud Community
TheVMinator
Expert
Expert
Jump to solution

PowerCLI Unmount VMware tools install

how can I check if vmware tools is mounted on a vm, and if so, automatically unmount install?

Thanks!

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You could do something like this

Get-VM | Get-CDDrive | where{$_.IsoPath -match "vmware/isoimages"} |

Set-CDDrive -NoMedia -Confirm:$false


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

View solution in original post

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

You could do something like this

Get-VM | Get-CDDrive | where{$_.IsoPath -match "vmware/isoimages"} |

Set-CDDrive -NoMedia -Confirm:$false


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

Reply
0 Kudos
AdrianTT
Enthusiast
Enthusiast
Jump to solution

Hi there,

The following should unmoun the Tools media if mounted on a VM;

Get-VM | ? {$_.ExtensionData.Runtime.ToolsInstallerMounted -eq $true } | Dismount-Tools

You can scope by adjusting the parameter for the Get-VM (eg. Get-VM "LAB*" | ? {$_.ExtensionData.Runtime.ToolsInstallerMounted -eq $true } | Dismount-Tools) or add a Get-ResorucePool XXX or Get-Cluster XXX to the pipe (Get-Cluster Lab | Get-VM | ? {$_.ExtensionData.Runtime.ToolsInstallerMounted -eq $true } | Dismount-Tools)

Kind regards,

Adrian

Please consider marking this answer "correct" or "helpful" if you think your query have been answered correctly. Cheers,
TheVMinator
Expert
Expert
Jump to solution

thanks all!

Reply
0 Kudos