Powershell takes a list of servers and adds a "server" property
I want to combine data from two sources in an existing script.
I have one server list that is pulled through a Citrix command called Get-XAServer
. This cmdlet creates an array with two properties server
and logonmode
. The execution $1stList
looks like this:
SERVER LOGONMODE
Server1 AllowLogOns
Server2 AllowLogOns
Now I want to update this list of servers that cannot be pulled using the cmdlet Get-XAServer
. So, inside the script, I just got an array variable that looks like this, but from a list of servers, which are in the following format:
$2ndList = "Server3", "Server4", "Server5"
The problem is that the property is server
not bound to the second list. So when I try to concatenate the arrays, they are not being handled as expected.
How do I iterate through the second list so that the properties server
and logonmode
are added to every / every server in the array $2ndList
?
source to share