PowerShell Script String Issue

Welcome Forums General PowerShell Q&A PowerShell Script String Issue

Viewing 1 reply thread
  • Author
    Posts
    • #241232
      Participant
      Topics: 1
      Replies: 0
      Points: 13
      Rank: Member

      Most of the script is working as expected, however I hit a snag at the end. The part where it says Where DisplayName -eq $String refuses to work even with a simple hard-coded variable like $String = "Pulse Secure". If I instead type in Where DisplayName -eq "Pulse Secure" it magically works. I’ve commented out a bit of the code at the end and have just been using Write-Host $UninstallString to test if the string is processing properly (it should print the msiexec uninstall line if it works correctly). The end goal is to make $String = the program from the listbox that the user has selected, which should work once I figure this string issue out.

      [/crayon]
    • #241346
      Participant
      Topics: 17
      Replies: 1949
      Points: 3,975
      Helping Hand
      Rank: Community Hero

      Use the label, not Write-Host to debug:

Viewing 1 reply thread
  • The topic ‘PowerShell Script String Issue’ is closed to new replies.