VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts)
2 Replies Last post: Nov 6, 2008 9:49 AM by SCampbell  

list of VMs with a specific ISO attached posted: Nov 6, 2008 9:30 AM

Click to view Mizzou_RobMan's profile Hot Shot 98 posts since
Jul 3, 2007
I'm trying to create a list of VMs whish a specific ISO attached. However when I run the following, it does not tell me the name of the VM. I need the VM name to verify with the VM owner that I can remove the ISO as they may using the ISO.

{noformat}PS C:\Program Files (x86)\VMware\Infrastructure\VIToolkitForWindows> $vms | get-cddrive | where {$_.ISOPath -like "*2.0.8.iso*"}{noformat}

Here is a snippet of the results:

{noformat}IsoPath         : [TestSAN-DC1-Vol1] ISOs/SMG_WinPE20_x86_v2.0.8.iso
HostDevice      :
RemoteDevice    :
ConnectionState : VMware.VimAutomation.Client20.ConnectInfoImpl
Id              : VirtualMachine-vm-1148/3000
Name            : CD/DVD Drive 1{noformat}


Message was edited by: halr9000: used code and noformat tags to pretty it up

Re: list of VMs with a specific ISO attached

1. Nov 6, 2008 9:32 AM in response to: Mizzou_RobMan
Click to view halr9000's profile Master vExpert 846 posts since
Jun 7, 2007
I'd try something like this:

{noformat}foreach ($vm in $vms) {
	if ( $vm | get-cddrive | where {$_.ISOPath -like "*2.0.8.iso*"} ) {
		Write-Output $vm
	}
}{noformat}







PowerShell MVP, VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)

Re: list of VMs with a specific ISO attached

2. Nov 6, 2008 9:51 AM in response to: Mizzou_RobMan
Click to view SCampbell's profile Enthusiast 106 posts since
Apr 18, 2005
This might work:



Get-VM | Where-Object { $Null -ne ($_ | Get-CDdrive | Where-Object { $_.ISOPath -like "*2.0.8.iso*"})}




Oops: Just saw Hal's. It looks like it will work too.

VMware Beta Programs

Want to be Considered for Future Beta Programs?

Learn More

VMware Developer

Download SDKs, APIs, videos,
training, and more in the Developer community.

Learn More

Developer
Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld
Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

Only VMware ... Delivers Nexus 1000V

Ensure consistent, policy-based network capabilities to virtual machines across your data center.

Learn More

Communities