Popup message occurs when value is correct

Welcome Forums General PowerShell Q&A Popup message occurs when value is correct

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 month ago.

  • Author
    Posts
  • #178095

    Participant
    Topics: 7
    Replies: 9
    Points: 102
    Rank: Participant

    The value from the .ini file does return correctly as shown in blue below. What I cannot figure out is why my message box is still popping up when the value IS Fujitsu fi-71* or 72*...I only want it to do so when the value selected and set in the .ini file is neither of the supported options.

    $Value = Get-Content -Path C:\ProgramData\Kofax\Vrs\kofax200.ini | Where-Object { $_ -match 'DefaultSource32' }
    $Value.Split('=')[1]

    If ($Value -notlike "Fujitsu fi-71*" -or "Fujitsu fi-72*"){
    $wshell = New-Object -ComObject Wscript.Shell
    $Output = $wshell.Popup("Model selection unsupported. Please re-open utility and choose Fujitsu 7160 or 7260")
    }
    Fujitsu fi-7160 with SVRS with AIPE

  • #178101

    Participant
    Topics: 1
    Replies: 1552
    Points: 2,700
    Helping Hand
    Rank: Community Hero

    Your condition is wrong ... should be something like this:

    $Value = 'Fujitsu fi-7160 with SVRS with AIPE'
    If ($Value -notlike "Fujitsu fi-71*" -and $Value -notlike "Fujitsu fi-72*"){
        $wshell = New-Object -ComObject Wscript.Shell
        $Output = $wshell.Popup("Model selection unsupported. Please re-open utility and choose Fujitsu 7160 or 7260")
    }
    • #178107

      Participant
      Topics: 7
      Replies: 9
      Points: 102
      Rank: Participant

      Thank you, Olaf. I greatly appreciate your help!

You must be logged in to reply to this topic.