Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 3 months and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Hi All
It seems like Powershell Studio has some Problems when using Find-PSResource.
The Script just hangs and keeps hanging until manual stop.
Steps to reproduce:
1. Creating a new Windows Forms Script (no matter which PWSH Version)
2. Be sure to trust your Repository (for test you can also use PSGallery)
3. Using Find-PSResource with -Respository and -Name Param
4. Script hangs
5. Comment the line with Find-PSResource will make the whole script work again
I tried Powershell Studio 2022, 2023 and 2024 5.8.246.
Console Output (debug):
Based off my tests, I have not been able to get Find-PSResource to work after the initialization of any form object.
For example, the following code will hang regardless of where I run it (Console, PowerShell Studio, etc):
We have seen similar behavior with other commands such as Connect-ExchangeOnline. Most Azure and "online" products require connection and loading of modules before you display any form. This is most likely due to the "single-threaded" nature of PowerShell. Most APIs rely on being able to control a thread completely until the connection operation is completed. Forms and GUIs tend to disrupt this and cause failures in online connective processes. While I'm aware this is not exactly the same, there seems to be a similar thread issue happening which results in the script hanging.
Thanks a lot for testing Brittney.
I think the only workaround in my case is to avoid using Find-PSResource, otherwise it will load too long at the Script startup.
So in this case i want to add the Module via Custom Installer but since my Module has the pwsh7 Requirement, is it possible to install Powershell 7 also direct via Powershell Studio buildt in Functions?
Or is it possible to simply pack a whole Scriptfolder with several Scripts into a Powershell Studio compiled Script and deploy that specific ScriptFolder to a specific location?
This topic is 3 months and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.