From df32c591484a3e90ef78086b19a73f9703253764 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 31 Oct 2017 11:17:36 -0400 Subject: [PATCH] Use the item in foreach rather than collection Error message should use $v rather than $vm --- Scripts/Get-VMNetworkPortId.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/Get-VMNetworkPortId.ps1 b/Scripts/Get-VMNetworkPortId.ps1 index ed130a6..eeb2e62 100644 --- a/Scripts/Get-VMNetworkPortId.ps1 +++ b/Scripts/Get-VMNetworkPortId.ps1 @@ -30,7 +30,7 @@ foreach ($v in $vm) { #Validate the input is a valid VM $vmobj = Get-VM -Name $v -erroraction silentlycontinue - if (!$vmobj) {Write-Verbose "No VM found by the name $vm."} + if (!$vmobj) {Write-Verbose "No VM found by the name $v."} else { #Create a temporary object to store individual ouput $tempout = "" | select VM,PortId