LucD
Leadership
Leadership

There are 2 cmdlets, Get-VM and Get-Template.

If you suppress the errors you could use those. For example

$names = Get-Content names.txt

$vms = Get-VM -Name $names -ErrorAction SIlentlyContinue

$templates = Get-Template -Name $names -ErrorAction SilentlyContinue

Or do you mean something else ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference