Failed to locate Environment

Product: PowerShell Universal
Version: 3.7.7

Getting message when running a job
“Failed to locate PowerShell Universal version: 7.3.1”

Settings > Environments list is blank

Restarting the service corrects the issues, but this is not sustainable.

When you restart the service, does the environments list show up?

Yes as I was able to see them listed and the Job are able to run again.

We may need to review a log to see why this is happening. Do you have an environments.ps1 file on your system? You can find it in Settings \ Configurations \ Repository \ .universal

I do not see a environments.ps1 file.
I think I have debug logging on.

What I would recommend trying is to make a small change to the environments in Settings \ Environments. Like adjust the max runspaces slightly. This will cause it to create an environments.ps1 file and then it won’t try to detect PS during startup and use the static list of environments.

I’m not sure why it wouldn’t always detect PS7.3.1 but this will make sure that doesn’t happen any more.

I made the change and let you know if it returns

1 Like

I have stumble onto steps that I can now repeat the issue in my environment.
PSU 3.7.7

Git Settings

Steps taken
Modify a script
Run script modified script several times
Edit Script setting. I was changing the Error Action
Cancel Editing
Now cannot run jobs

Environments are missing

Interesting. Do you see any errors logged or notification errors after you do this?

No error messages and nothing stands out in the logs. I will rebuild my lab instance to see if that fixes it.