Hi Guys,
Can someone help me modify this script to find all VM's with flexible adapters regardless of the Tools Status?
If it could display the OS type too that would be great.
# Get all VM objects
$vms = get-view -viewtype virtualmachine
# Set up an empty array
$table = @()
# For Every Vm...
Foreach ($vm in $vms)
{
# If Tools aren't installed and there is a PCNet32 adapter in the hardware list...
if ($vm.guest.toolsstatus -eq "toolsNotInstalled" -and (($vm.config.hardware.device | %{$_ -is [VMware.Vim.VirtualPCNet32]}) -contains $true))
{
# Then output it to an object and add it to the array
$table += New-Object PSObject -Property @{"Name"=$vm.name; "ToolsStatus"=$vm.guest.toolsstatus; "NicType"="Flexible"}
}
}
# Output the table. You can Export to a CSV or whatever here.
$table
The following code finds all vm's with flexible adapters:
# Get all VM objects
$vms = get-view -viewtype virtualmachine -Property name,config.hardware.device
# Set up an empty array
$table = @()
# For Every Vm...
Foreach ($vm in $vms)
{
# If there is a PCNet32 adapter in the hardware list...
if ((($vm.config.hardware.device | %{$_ -is [VMware.Vim.VirtualPCNet32]}) -contains $true))
{
# Then output it to an object and add it to the array
$table += New-Object PSObject -Property @{"Name"=$vm.name; "NicType"="Flexible"}
}
}
# Output the table. You can Export to a CSV or whatever here.
$table
The following code finds all vm's with flexible adapters:
# Get all VM objects
$vms = get-view -viewtype virtualmachine -Property name,config.hardware.device
# Set up an empty array
$table = @()
# For Every Vm...
Foreach ($vm in $vms)
{
# If there is a PCNet32 adapter in the hardware list...
if ((($vm.config.hardware.device | %{$_ -is [VMware.Vim.VirtualPCNet32]}) -contains $true))
{
# Then output it to an object and add it to the array
$table += New-Object PSObject -Property @{"Name"=$vm.name; "NicType"="Flexible"}
}
}
# Output the table. You can Export to a CSV or whatever here.
$table
Hi There,
Thanks any chance we can modify to find VM with VMXNET3 ?
Thats cool, I just replaced VirtualPCNet32 with Vmxnet3