Please I need help... two identical strings are not returning $True when checking on IF logical statement.
The images illustrates perfectly my frustration. I'm starting with GUIs don't be cruel please.
I've tried checking with label text with variables from textbox.text everything that came to my mind...
blob:https://imgur.com/5fcdabfb-b86e-436d-9c57-ed5f97c48229
Write-Host "$Udrive\$($comboSamaccount.Text)"
Write-Host "$Homedirectory"
$Udriveinfo = "$Udrive\$($comboSamaccount.Text)"
$labeUdriveINFO.Text = $Udriveinfo
$labeUdriveINFO.Text -eq "$Homedirectory"
if ("$Udrive\$($comboSamaccount.Text)" -eq "$Homedirectory")
{
$Ud = "The U drive is - OK"
}
else
{
$Ud = "The U drive must be changed to $Udrive\$($comboSamaccount.Text)"
}
}
Thanks in advance.
Best regards.
For the purposes of troubleshooting this, I'd do the following:
$a = "$Udrive\$($comboSamaccount.Text)"
$b = "$Homedirectory"
for($i = 0; $i -lt $a.Length; $i++)
{
if("$($a[$i])" -ne "$($b[$i])"){
Write-Host 'Mismatch found' -ForegroundColor Red
Write-Host ('[{4:D2}] {0}:{1:X} - {2}:{3:X}' -f $a[$i],(+$a[$i]),$b[$i],(+$b[$i]),$i)
}
}
This will go through the characters in the strings one by one and try to find the ones that aren't the same