Is there a way to make the azure pipeline task PowerShellonTargetMachines hit the powershell core endpoint instead of the windows powershell endpoint?
Changing the machine profile doesn't seem to be an option for us and I tried running Enable-PSRemoting on powershell 7 on a target machine and then trying to run an inline script targetting that machine via the PowerShellonTargetMachines task that include this code to start a powershell 7.4.2 instance but it still says 7.4.2 doesn't exist even though it is installed and clearly from the error message it's still hitting windows powershell instead of powershell core. Why isn't there a newer version of PowerShellonTargetMachines that directly supports powershell core.
if ($PSVersionTable.PSVersion -lt [Version]"7.4.2") {
Write-Output "Restarting powershell to get correct version"
powershell -Version 7.4.2 -File $MyInvocation.MyCommand.Definition
exit
}
2024-11-06T04:51:07.7257943Z
2024-11-06T04:51:07.7693744Z Cannot start Windows Powershell version 7.4.2 because it is not installed```