Use the item in foreach rather than collection
Error message should use $v rather than $vm
This commit is contained in:
1 parent
795bcccad8
commit
df32c59148
1 file changed
+1
-1
@@ -30,7 +30,7 @@
|
|||||||
foreach ($v in $vm) {
|
foreach ($v in $vm) {
|
||||||
#Validate the input is a valid VM
|
#Validate the input is a valid VM
|
||||||
$vmobj = Get-VM -Name $v -erroraction silentlycontinue
|
$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 {
|
else {
|
||||||
#Create a temporary object to store individual ouput
|
#Create a temporary object to store individual ouput
|
||||||
$tempout = "" | select VM,PortId
|
$tempout = "" | select VM,PortId
|
||||||
|
|||||||
Reference in new issue
Block a user