I'd like to run PowerShell Pester tests using Vagrant on Windows Server 2008R2.
Windows Server 2008R2 has PowerShell 3.0 installed by default, and I'd obviously prefer to use a more modern version of PowerShell.
I can install PowerShell 6 using Chocolatey (e.g. choco install powershell.portable
), but then I struggle to force the provisioner to use this version of PowerShell.
I use the shell provisioner:
node.vm.provision 'invoke-tests',
:type => 'shell',
:path => "provisioners/invoke-tests.ps1"
I thought about changing the ps1
file association from powershell.exe
to pwsh.exe
on a Vagrant machine in a separate provisioner that runs before the provisioner executing my tests, but I'm not sure if that would work. Also, perhaps there is an easier way of achieving it?