In PowerShell how to compare Invoke-WebRequest content to a string
<p>In my web page I create simple php script that on browser displays only my IP address as simple text in web page.</p>

<p>So if I use this command in PowerShell:</p>

<pre><code>$ip = Invoke-WebRequest https://www.mypage.com
$ip
</code></pre>

<p>I get this result:</p>

<pre><code>PS C:\Users\user&gt; $ip
193.60.50.55
</code></pre>

<p>If I check what kind of variable is with: GetType().FullName I get:</p>

<pre><code>PS C:\Users\user&gt; $ip.GetType().FullName
System.String
</code></pre>

<p>And If I try to compare it with same string</p>

<pre><code>PS C:\Users\user&gt; $ip = Invoke-WebRequest https://www.mypage.com
$ip2 = "193.60.50.55"
$ip -eq $ip2
</code></pre>

<p>I get result "False", I also try with -match and -like but result is always false</p>

<p>Any Idea what is wrong</p>