Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-60423

Powershell fails when the script starts with 'CmdletBinding' attribut

    • powershell-1.8

      Hi, 

       

      Since upgrade to the latest version of PowerShell Plugin (1.4) a lot of my scripts does not work any more.

      Especially when inline or script files starts with the 'CmdletBinding' attribut.

      [workspace] $ powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File C:\Users\ATHICS~1\AppData\Local\Temp\jenkins8862236051379677851.ps1

      Au caractŠre C:\Users\AthicService\AppData\Local\Temp\jenkins8862236051379677851.ps1:3 : 1

      + [CmdletBinding()]

      ~+ ~~~~~~~~~~~~~~~~~~

      Attribut inattendu ®ÿCmdletBindingÿ¯.

      Au caractŠre C:\Users\AthicService\AppData\Local\Temp\jenkins8862236051379677851.ps1:4 : 1

      + param([switch]$Elevated

      ~+ ~~~~~~

      Jeton inattendu ®ÿparamÿ¯ dans l'expression ou l'instruction.

          + CategoryInfo          : ParserError: ( [], ParentContainsErrorRecordException

          + FullyQualifiedErrorId : UnexpectedAttribute

       

      Build step 'PowerShell' marked build as failure

       

       

      As I have a lot of PS scripts like that, I have to downgrade to 1.3 version.

       

          [JENKINS-60423] Powershell fails when the script starts with 'CmdletBinding' attribut

          Aleksander Kasprzyk created issue -
          Owen Mehegan made changes -
          Assignee New: Filipe Roque [ froque ]
          Filipe Roque made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Filipe Roque made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Fixed but Unreleased [ 10203 ]
          Filipe Roque made changes -
          Released As New: powershell-1.8
          Status Original: Fixed but Unreleased [ 10203 ] New: Resolved [ 5 ]
          Filipe Roque made changes -
          Link New: This issue duplicates JENKINS-63153 [ JENKINS-63153 ]

            froque Filipe Roque
            soruk Aleksander Kasprzyk
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: