Q:

extract value between two square braces

I need to extract the value between two square braces from a specific line in a command output. Here's the output of the command.
C:\Informatica\PowerCenter\isp\bin> .\infacmd.bat ping -dn Infadomain -nn Node01
[INFACMD_10052] Node [Node01] Domain [Infadomain] Host:Port [infadev:6005] was successfully pinged.
[INFACMD_10470] Kerberos authentication is [disabled] and secure communication is [disabled] in the Informatica domain [Infadomain].
Command ran successfully.

From the above output, I need to extract the value 'infadev' from the above command result. I tried the regex functions to extract the value but somehow the code does not work.
$cmd = Invoke-Command -ScriptBlock {& cmd.exe /c "infacmd.bat ping" -dn "Infadomain" -nn "Node01"}  | Where-Object {$_ -ne 'Command ran successfully.'}
$result = $cmd |(\[(?:\[??[^\[]*?\]))
write-host $result

At line:2 char:17 + $result = $cmd |([(?:[??[^[]*?])) + ~~~~~~~~~~~~~~~~~~~~~ Expressions are only allowed as the first element of a pipeline. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : ExpressionsMustBeFirstInPipeline 

invoke-command -ScriptBlock {& cmd.exe /c "infacmd.bat ping" -dn "InfaDomain" -nn "Node01"} | Where-Object {$_ -ne 'Command ran successfully.'}

A:

this is another take on the idea. [grin] it uses a named capture group to grab the 1st set of bracketed data after the Host:Port text.   
$Cmd = @'
[INFACMD_10052] Node [Node01] Domain [Infadomain] Host:Port [infadev:6005] was successfully pinged.
[INFACMD_10470] Kerberos authentication is [disabled] and secure communication is [disabled] in the Informatica domain [Infadomain].
Command ran successfully.
'@ -split [environment]::NewLine

$Null = $Cmd.ForEach({$_ -match 'Host:Port \[(?<HostPortInfo>.+)\]'})

$Matches.HostPortInfo

output ...    
infadev:6005

