?
Solved

Modifying Powershell to list VM with certain hardware installed

Posted on 2010-11-16
6
Medium Priority
?
823 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
[X]
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
  • 3
  • 2
6 Comments
 
LVL 24

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 71

Accepted Solution

by:
Chris Dent earned 2000 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
Ransomware Attacks Keeping You Up at Night?

Will your organization be ransomware's next victim?  The good news is that these attacks are predicable and therefore preventable. Learn more about how you can  stop a ransomware attacks before encryption takes place with our Ransomware Prevention Kit!

 
LVL 1

Author Comment

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

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When rebooting a vCenters 6.0 and try to connect using vSphere Client we get this issue "Invalid URL: The hostname could not parsed." When we get this error we need to do some changes in the vCenter advanced settings to fix the issue.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Teach the user how to edit .vmx files to add advanced configuration options Open vSphere Web Client: Edit Settings for a VM: Choose VM Options -> Advanced: Add Configuration Parameters:
Teach the user how to configure vSphere Replication and how to protect and recover VMs Open vSphere Web Client: Verify vsphere Replication is enabled: Enable vSphere Replication for a virtual machine: Verify replicated VM is created: Recover replica…
Suggested Courses

764 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