Tool: Visual Studio, Visual Studio Code Version: 2022.3.0
I created a Powershell GUI (WinForms) a while ago, based on Windows Powershell 5.1, which works fine. No issues or anything strange. The GUI is used to download and install software from an FTP Server, by using checkboxes to select the required Software.
But now I tried to create this same GUI with Powershell 7.2.0 and I noticed a few things:
- First of all it seems that the “Require Elevation” feature does not work as expected. It does generate an executable, but I manually need to run it as Administrator (Right Click → Run As Administrator). When I just double click it, it won’t start and generates a small error log file in the same folder after a few seconds which states that I don’t have the Rights to for the change (os error 740).
See Screenshot, the first file is the error. The Installaties.exe is the Windows Powershell 5.1 GUI and the Installaties2.exe is the Powershell 7.2.0 version.
- The second thing is that the Console Output is blank. In my Windows Powershell 5.1 version, after I click OK to start the installations, it shows when a Package is successfully installed or gives an error if not and then Pauses (“Press Enter to Continue…”).
But when I start it from the Powershell 7.2.0 version, the Console Window shows nothing. Only when I force an error (For example by filling in the wrong FTP Password), it doesn’t show me error, but it will show the standard “Press Enter to Continue…” message (generated by using Pause in the Powershell Script).
See below my settings from Visual Studio 2022.
The same happens in Visual Studio Code.
I’m not sure what I am doing wrong here, Hope someone could help me out.