Environment start scripts

avatar

After upgrading PowerShell Universal from 2026.1.7.0 to 2026.2.1.0, the functions used by our endpoints and apps are no longer being recognized.
For some context, the environments used by our endpoints and apps are configured to run a script at runspace startup that dot-sources all of our functions. This setup has worked correctly in all previous versions, but it stopped working immediately after the upgrade.
Has anyone else experienced the same issue or found a workaround?

All Comments (14)

avatar

Hello,

Thank you for your feedback.

I moved your thread to the PowerShell Universal Support section.

Do you get any specific errors related to this scenario?

Best regards,

Érica Poirier

avatar

Not really.
The errors I get are related to function not being recognised, standard Powershell error message.

avatar

@tcheguri84 Could you please share your current environments.ps1 file in your .universal folder? I'd like to try to reproduce your issue in my environment.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar

Sure...

Publish-RSQLFunctions.ps1

Get-ChildItem -Path 'C:\ProgramData\UniversalAutomation\Repository\.universal\functions' -Exclude $MyInvocation.MyCommand.Name,'Add-RSQLEndpoints.ps1' -Recurse | Where-Object { $_.Extension -eq '.ps1' } | ForEach-Object {
    . ($_.FullName)
}


Environments.ps1

New-PSUEnvironment -Name "Agent" -Path "Universal.Agent" -Variables @('*') 
New-PSUEnvironment -Name "Integrated" -Path "Universal.Server" -Modules @('ActiveDirectory', 'dbatools', 'RaboSQL') -Variables @('*') -PersistentRunspace -StartupScript @('C:\ProgramData\UniversalAutomation\Repository\.universal\functions\Publish-RSQLFunctions.ps1') 
New-PSUEnvironment -Name "Windows PowerShell 5.1" -Path "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -Modules @('ActiveDirectory', 'dbatools', 'RaboSQL') -Variables @('*') -PersistentRunspace -StartupScript @('C:\ProgramData\UniversalAutomation\Repository\.universal\functions\Publish-RSQLFunctions.ps1') 
New-PSUEnvironment -Name "Windows PowerShell 7" -Path "C:\Program Files\PowerShell\7\pwsh.exe" -Modules @('ActiveDirectory', 'dbatools', 'RaboSQL') -Variables @('*') -PersistentRunspace -StartupScript @('C:\ProgramData\UniversalAutomation\Repository\.universal\functions\Publish-RSQLFunctions.ps1')
avatar

@tcheguri84 Thank you. I'll let you know once we have a fix or a workaround.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar

Ok. Thank you

avatar

@Adam Driscoll did you have the time to test it? Thanks

avatar

@tcheguri84 Yes, I did and was able to reproduce this problem. We have a fix already merged and it will be in 2026.2.2. That will be out this week.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar
@tcheguri84 Yes, I did and was able to reproduce this problem. We have a fix already merged and it will be in 2026.2.2. That will be out this week.


@Adam Driscoll
Great news, thank you again.

avatar

@Adam Driscoll after the upgrade to the latest version I am getting this:

HTTP Error 500.32 - Failed to load .NET Core host
Common solutions to this issue:
The app was likely published for a different bitness than w3wp.exe/iisexpress.exe is running as.
Troubleshooting steps:

  • Check the system event log for error messages
  • Enable logging the application process' stdout messages
  • Attach a debugger to the application process and inspect

For more guidance on diagnosing and handling these errors, visit Troubleshoot ASP.NET Core on Azure App Service and IIS.

I am running PSU on IIS 10. Could you please help?

avatar

I found my mistake. Nevermind. Thanks

avatar

@Adam Driscoll I have completed the upgrade however the issue remains. This is an App page.

e8b71ae8-26c7-4483-a1bf-61df9282c692.png

avatar

I am also getting this error on 2026.2.2.0



698e9c0e-96a4-4d85-9f20-d8c45ff664c4.png

a0bdc6da-e907-41f3-a479-01f17846597d.png

c646461c-a23b-449e-9a96-b89c31ded09a.png

avatar

@malcolmradelet @tcheguri84 I'm sorry to hear that. I've reactivated the issue and we will take another look. I'll post an update if we need more information.

Adam Driscoll
PowerShell Expert and Developer at Devolutions