You were close. The first line required a small change in the position of the quotes. Then, you just needed to explicitly refer to the PrefixOrigin value of $POM and $SIP which is what you wanted to compare.
This should also work.
$POM = 'Manual'
$SIP = Get-NetIPAddress -InterfaceAlias Wi-Fi -AddressFamily IPv4 | Select-Object PrefixOrigin
write-host $POM
write-host $SIP.PrefixOrigin
If ($SIP.PrefixOrigin -eq $POM) {
write-host "IP address is Static " -foreground Blue -BackgroundColor Green
}Else{
write-host "IP address is Not Static" -foreground Yellow -BackgroundColor DarkMagenta
}
Here , instead of assigning a key value pair to $POM, I used a string with the value that is required for comparison purposes later in the If/Else statement. Since it is no longer a key value pair, $POM will return “Manual” without the need to refer to its PrefixOrigin property (that no longer exists in this example anyway).
Just wanted to add that the reason they weren’t equal is because they are objects. Even the same exact hash tables are not equal, because they aren’t the same object. Situations like this you could easily check a property value (or multiple in other circumstances.)