Different images

oliver's Avatar


30 Dec, 2017 10:13 PM


I am using AppVeyor for several PowerShell module repositories.
I would like to be able to test the code on different versions of powershell.

However all images I tried are on version 5.0.10586.117.
Is there a way to use other versions? 3.0? 4.0? 5.1? Or even Core (6.0)?


  1. 1 Posted by Ilya Finkelshte... on 02 Jan, 2018 10:21 PM

    Ilya Finkelshteyn's Avatar

    Hi Oliver,

    Right now all our build worker images have PowerShell version 2 and 5 installed. This is default setting for Windows Server 2012 R2 and Windows Server 2016.

    If you have a idea how to install another versions of PowerShell on any of those OS (at least manually), we can help you with scripting it and running it at install stage of different jobs in build matrix.

    However if it requires different OS (like "Default Windows Servers" in this article), then your best bet would be running your own custom images with private build cloud. However this feature is available for Premium plan customers. We provide 50% discount for open source and trial is free.


  2. 2 Posted by oliver on 03 Jan, 2018 11:06 AM

    oliver's Avatar

    Thanks for the reply.

    If I install PowerShell Core (v6) during the install stage, it will not take over the - ps: blocks, right? (as the exe name is different)
    I would have to - cmd: pwsh -File foo.ps1, correct?

  3. 3 Posted by Ilya Finkelshte... on 04 Jan, 2018 01:10 AM

    Ilya Finkelshteyn's Avatar

    Correct, please check this sample and this build. I have to admin that this is not exactly the best experiences -- we are thinking about better PowerShell Core support.

  4. 4 Posted by oliver on 07 Jan, 2018 06:13 PM

    oliver's Avatar
  5. 5 Posted by oliver on 23 Jan, 2018 09:11 PM

    oliver's Avatar

    Hey @Ilya

    Now that PowerShell v6 is officially out... do you already know how to support it in AppVeyor?

    IMHO, a new environment variable that would call a script (similar to enable-rdp.ps1) that installs powershell v6 would be really cool, as it would be easy to use in the matrix block.

  6. 6 Posted by Ilya Finkelshte... on 23 Jan, 2018 09:29 PM

    Ilya Finkelshteyn's Avatar

    Sure PS Core support is already deployed at build workers, so you if prefix commands with - pwsh:, it will run PowerShell Core. UI part will be deployed today later. No colors in PowerShell Core console for now though, but we work on adding them later (it is tricky).

  7. 7 Posted by oliver on 24 Jan, 2018 10:03 AM

    oliver's Avatar

    That's great to hear!
    thank you.

    The best I could come up, to be able to controle it in the matrix, was this:

        fast_finish: true
            - image: Visual Studio 2013
            - image: Visual Studio 2017
              PowershellVersion: "6.0.0"

    init: - if not defined PowershellVersion (set PowershellVersion=5)

    before_build: - if %PowershellVersion:~0,1% gtr 5 (pwsh -Command "Invoke-Build") else (powershell -Command "Invoke-Build")

    In case you know of a simpler/cleaner way to do this, please let me know

  8. 8 Posted by Ilya Finkelshte... on 24 Jan, 2018 06:09 PM

    Ilya Finkelshteyn's Avatar

    Right, this is about all we can come up with if you need to choose PowerShell version in matrix. We are thinking how can we make it nicer, but for now your approach is OK. At least we saved your time on downloading and installing :)

  9. 9 Posted by oliver on 24 Jan, 2018 07:28 PM

    oliver's Avatar

    great, thanks.

    shall I open a discussion in case I think of a recommendation on how you can handle this?

  10. 10 Posted by Ilya Finkelshte... on 24 Jan, 2018 07:58 PM

    Ilya Finkelshteyn's Avatar

    Sure. Let us please do it at https://github.com/appveyor/ci/issues.

  11. oliver closed this discussion on 19 Mar, 2018 12:58 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac