VMware Cloud Community
IKirill
Enthusiast
Enthusiast
Jump to solution

Create one Array from another

Hi!

I can't remember how to Create one Array from another

I have this:

$newvms = @(

"VM_1.local",

"VM_2.local"

)

Foreach ($newvm in $newvms) {

$report = Get-VM | ? Name -like *$newvm*

}

$report

i this structure how i can get $report ?

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You mean like this?

$newvms = "VM_1.local","VM_2.local"

$report = Get-VM -Name $newvms

$report


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

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

You mean like this?

$newvms = "VM_1.local","VM_2.local"

$report = Get-VM -Name $newvms

$report


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

IKirill
Enthusiast
Enthusiast
Jump to solution

Thanks LUCD!

Its ok for me!

Reply
0 Kudos