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

Powershell fails when the script starts with 'CmdletBinding' attribut

XMLWordPrintable

    • 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.

       

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

              Created:
              Updated:
              Resolved: