I am calling nsExec::ExecToStack to get the output of a powershell command.  Based on the result, I will either do nothing, or install a windows feature.  I seem to get the result I expect from the powershell command, but the if/then logic is not doing what I expect.
Here's the code:
DetailPrint "======================"
DetailPrint "Checking MSMQ Services"
DetailPrint "======================"

nsExec::ExecToStack 'powershell.exe -command "(get-windowsfeature -name MSMQ-Services).InstallState"'
Pop $0
Pop $InstallState

DetailPrint "MSMQ is: $InstallState"

${If} $Installstate == "Installed"
    DetailPrint "MSMQ is Installed"
${Else}
    DetailPrint "========================"
    DetailPrint "Installing MSMQ Services"
    DetailPrint "========================"

    nsexec::exectolog 'powershell -command "install-windowsfeature -name msmq-services"'
    
${EndIf}

I set ${DisableX64FSRedirection} in the same section, above this code, to ensure powershell is the 64-bit version and can run the command properly.
Here is what I am seeing in the Log:
======================
Checking MSMQ Services
======================
MSMQ is: Installed

========================
Installing MSMQ Services
========================

Success Restart Needed Exit Code      Feature Result                               
------- -------------- ---------      --------------                               
True    Yes            NoChangeNeeded {}                                           


I have been staring at this code, tweaking, trying different logic...
Here is what the powershell command returns:
PS C:\Windows\system32> $tom=(get-windowsfeature -name MSMQ-Services).InstallState
PS C:\Windows\system32> echo $tom
Installed

First thought was that there were leading or trailing spaces, so I did the comparison with "X$InstallStateX".
I tried adding the /OEM flag to ExectoStack.
I tried variations of if/then logic:
${If} $Installstate != "Installed"
    <install command>
${EndIf}

Honestly, I'm not sure if this is a stupid logic flaw (on my part) or some funky output from exectostack that I'm not expecting.

Am I using NSIS nsexec::ExecToStack Output correctly?
It was just a CR/LF at the end of the PowerShell output.
By changing my statement to:
${If} $InstallState == "Installed$\r$\n"

Worked like it should.
It's always something simple in the end.
