Powershell returned value

Forums Desktop Info Powershell returned value

  • This topic is empty.
Viewing 1 reply thread
  • Author
    • #2610 Reply
      AvatarPeter Holter-Andersen

      I’m using powershell to check for a computer model name in a list, and return a descriptive word “replace” / “keep”. Everything works as intended, but when the results are placed into a variable, an unwelcome pipe added to the end somehow. Results:

      Message from IT:
      You should reinstall| your computer.

      Actual code:
      #Check model
      CMD=active:1,file:powershell.exe,parameters:if ( Select-String -path ‘.\Models.txt’ -Quiet -Pattern ((Get-WmiObject -Class:Win32_ComputerSystem).Model) ) { echo ‘replace’ } else { echo ‘reinstall’},display:%4,set:handling

      ## Message
      COMMENT=active:1,text:You must %handling% your computer.,font-size:120%,color:#ff0000

      Any ideas?

    • #2611 Reply
      AvatarPeter Holter-Andersen

      Adding -nownewline after the write-host command solved the problem.

Viewing 1 reply thread
Reply To: Powershell returned value
Your information:

Do NOT follow this link or you will be banned from the site!