Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 838
  • Last Modified:

Modifying Powershell to list VM with certain hardware installed

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
jjoz
Asked:
jjoz
  • 3
  • 2
1 Solution
 
Luciano PatrãoICT Senior Infraestructure  Engineer  Commented:
Hi again :)

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

Jail
0
 
Chris DentPowerShell DeveloperCommented:
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
 
jjozAuthor Commented:
Thanks Chris.
0
NEW Internet Security Report Now Available!

WatchGuard’s Threat Lab is a group of dedicated threat researchers committed to helping you stay ahead of the bad guys by providing in-depth analysis of the top security threats to your network.  Check out this quarters report on the threats that shook the industry in Q4 2017.

 
jjozAuthor Commented:
@BestWay, many thanks for your efforts in trying to help me man.
0
 
Luciano PatrãoICT Senior Infraestructure  Engineer  Commented:
Hi

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

Jail
0
 
jjozAuthor Commented:
no worries BestWay, all the best for you in your duty :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now