function Test-TeamCityComputerIsAvailable { <# .SYNOPSIS Test that given computer(s) are on and able to be connected to .PARAMETER ComputerName [string] Computer(s) to connect to. Assumes .fh.local domain .PARAMETER Type Optional Parameter. Type of TeamCity host(s) to return: All, Server(s), or Agent(s) #> [CmdletBinding()] [OutputType([Object])] param ( [Parameter(Mandatory = $false)] [string[]]$ComputerName, [ValidateSet("All", "Server", "Agent")] [Parameter(Mandatory = $false)] [string]$Type ) $logLead = Get-LogLeadName $resultObject = @{} if (!(Test-StringIsNullOrWhitespace -Value $Type)) { $ComputerName = Get-TeamCityHostnames -Type $Type } foreach ($computer in $ComputerName) { $result = Test-ComputerIsAvailable -ComputerName $computer Write-Host "$logLead : $computer : $result" $resultObject += @{$computer = "$result"} } Return $resultObject }