Split Array based on Test-Connection

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
kingkale
Posts: 9
Last visit: Mon Jun 18, 2018 5:34 pm

Re: Split Array based on Test-Connection

Post by kingkale »

I resolved the issue, there was an error with how my script was passing the variables. Thanks for all of your help!
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Split Array based on Test-Connection

Post by jvierra »

The folloing line:
$HostList += HostName

should be:
$HostList += $env:COMPUTERNAME

Why use a system utility function when PowerShell provides the correct string.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Split Array based on Test-Connection

Post by jvierra »

kingkale wrote: Sun May 27, 2018 8:49 am I resolved the issue, there was an error with how my script was passing the variables. Thanks for all of your help!
Again. You do not need arraylist. THe following line creates a correct array.

$hostlist = Get-Content comuters.txt
This topic is 5 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked