Solved

Modifying Powershell to list VM with certain hardware installed

Posted on 2010-11-16
6
792 Views
Last Modified: 2012-05-10
Hi,

I'd like to know if it is possible to modify this script to include the adapter type in the next column ?

Thanks,

JJ

Note: this is the continuation from http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_26591906.html
###########################################################################################

# TScript: List VMs with Network Adapter Type											  #

# Created by: Luciano Patrão													       	  #

# Date: 04-10-2010   						 	     	                	       		  #

###########################################################################################



Connect-VIServer $server -User $user -Password $pwd



$vms = Get-VM

write "`nVM's with Network Adapter Type: "

foreach ($vm in $vms | where { $_ | get-NetworkAdapter | where { $_.TYPE -ne "vmxnet3"} })  

{write $vm.name}

Open in new window

0
Comment
Question by:jjoz
  • 3
  • 2
6 Comments
 
LVL 22

Expert Comment

by:Luciano Patrão
ID: 34143093
Hi again :)

I will create you a new script in the end of the day, then I will post it here

Jail
0
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 34144045
Hello there,

It depends a little on what you'd like to see exactly. But you can add the Adapter Type as a property to the output:

Get-VM | Select-Object Name, 
  @{n='AdapterType';e={
    $_ | Get-NetworkAdapter | Where-Object { $_.Type -ne "vmxnet3" } | Select-Object -Expand Type }}

Open in new window


Don't forget you can use Export-CSV if you want that pumping out to a file.

HTH

Chris
0
 
LVL 1

Author Closing Comment

by:jjoz
ID: 34161434
Thanks Chris.
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
LVL 1

Author Comment

by:jjoz
ID: 34161443
@BestWay, many thanks for your efforts in trying to help me man.
0
 
LVL 22

Expert Comment

by:Luciano Patrão
ID: 34162842
Hi

Sorry I have been busy. But glade that you have manage.

Jail
0
 
LVL 1

Author Comment

by:jjoz
ID: 34163690
no worries BestWay, all the best for you in your duty :-)
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

This article will help you understand what HashTables are and how to use them in PowerShell.
HOW TO: Upload an ISO image to a VMware datastore for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere Host Client, and checking its MD5 checksum signature is correct.  It's a good idea to compare checksums, because many installat…
Teach the user how to delpoy the vCenter Server Appliance and how to configure its network settings Deploy OVF: Open VM console and configure networking:
This video shows you how easy it is to boot from ISO images for virtual machines with the ISO images stored on a local datastore on the ESXi host.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now