Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Modifying Powershell to list VM with certain hardware installed

Posted on 2010-11-16
6
803 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 23

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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 1

Author Comment

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A brief introduction to what I consider to be the best editor for PowerShell.
Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
Teach the user how to join ESXi hosts to Active Directory domains Open vSphere Client: Join ESXi host to AD domain: Verify ESXi computer account in AD: Configure permissions for domain user in ESXi: Test domain user login to ESXi host:
This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…

809 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