I have written a script that reminds me on refreshing flows and powerapps according to a specific time rule.
Now I wanted to create an Azure function that ran every week but I do get an error that the assembly "System.Windows.Forms" could not be found.
2022-07-27T03:56:34Z [Error] EXCEPTION: The following exception occurred while retrieving member "WithAuthority": "Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified."
I call the following cmdlet:
Were you able to resolve this in the end? Facing the same issue 😕
I'm assuming you're running a Powershell core version of the Azure Function (and running the latest version of Powershell core)
I'm also guessing your powershell script has the necessary commands to install the powershell modules.
One thing you could try is importing the module but use the "-UseWindowsPowerShell" argument (this generates a proxy module that uses local Windows Powershell, but I'm not sure if an Azure function running Powershell Core runtime on windows would still have the full powershell stack installed)
Another option you may consider is Azure Automation runbooks which can allow you to schedule powershell scripts execution whenever you want
Is there anyone who can help?
bscarlavai33
5
Super User 2025 Season 1
Michael E. Gernaey
4
Super User 2025 Season 1
Vince_K
2