Failed to locate Powershell version: default

Environment 5.1.14393.5582

We are running many psu scripts but this one, for some reason, gives us this error in the error tab, not in the main output. I can’t find anything that would say why this is happening as it should be the same as the other scripts. Also, it is being ran on a schedule. If I run it manually, it works.

Failed to locate PowerShell version: default

Hi @jreeddwa,

Have a look in your environments.ps1 file and make sure the data is not that of an older version.

I have had this in the past where that error has come up, and the problem was traced to the environments in the ps1 file being recognized as custom (not default) and PSU did not upgrade the environments.

I got around that issue by replacing the environments.ps1 file (Backing it up 1st of course) with the environments.ps1 file from a fresh installation.

The odd thing is that it works on the other 50 or so scripts that are all built the same. It only fails on this one.

Are sure the not trying to call another environment?

Try setting the script to another environment and then switching it back. You may have a phantom environment entry (same name, different environment ID)

Hey Matt,

Where would I check that? There is nothing in the script itself that’s changing any env settings. The environment settings over all haven’t been changed and, like I said, we run at least 50 scripts a day with no issues. I used them as a shell for this one so I don’t know why it would change the default for this one only.

If you take a look at your list of scripts in PSU and check the settings, there should be a box which allows you to select which environment to run it as.

I’m away from my test rig at the moment for the next few days, so I can’t be very specific with the steps I’m afraid

Thanks. Yea, I only see one environment in the settings and that script is set to default. However, there is just the one in the env so it must be the default. LOL

In your schedule.ps1 file, does it literally have -Environment “default” on the schedule that is failing? If so, I’d try just removing that.

1 Like