I don't understand why my array produces output I can't use

Viewed 46

I am trying to create list of computers which I can work on using Get-Computer. Here are two ways to create the list. I don’t understand why they are different or how I can get the results of the two methods to have the same value.

My code is:

    $ComputerList1 = "WS7-HUR-MANAGER","WS7-HUR-NURSE"
    $ComputerList2 = Get-ADComputer -Filter {Name -like "WS7-HUR*"} | Select`   Name
    Get-Variable ComputerList1 | Select Name, Value
    Get-Variable ComputerList2 | Select Name, Value

The output:

Name              Value                                           
----              -----                                           
ComputerList1     {WS7-HUR-MANAGER, WS7-HUR-NURSE}                
ComputerList2     {@{Name=WS7-HUR-MANAGER}, @{Name=WS7-HUR-NURSE}} 
2 Answers
Related