I have a problem with Azre DevOps Release pipeline which is similar to this issue.
I was investigating this and found quite strange behavior on the following lines of the AppCmdOnTargetMachines module:
$isItSameBinding = $result.Get(4).Contains([string]::Format("{0}:{1}", $hostname, $port))
...
$isItSameBinding = $result.Get(4).Contains([string]::Format("{0}:{1}", $ipAddress, $port))
...
$isItSameCert = $result.Get(5).ToLower().Contains($certhash.ToLower())
In my environment this checking always returns false. But if i replace $result.Get(4) to $result.Get(6) and $result.Get(5) to $result.Get(7), similar ps script works correctly.
And in fact i see that in the "netsh show sslcert" output needed data are located on lines 6 and 7, but not 4 and 5. Is it possible that the command output was changed?