This is the result of PowerShell's execution policy rather than a problem with the script itself. The first error indicated that your system was configured to prevent scripts from running at all. After changing the execution policy, PowerShell moved on to the next security check and discovered that the script is not digitally signed.
Whether an unsigned script is allowed depends on the execution policy that applies to the PowerShell session. For example, the Restricted policy blocks all scripts, RemoteSigned allows locally created scripts to run but requires downloaded scripts to be digitally signed, AllSigned requires every script to be signed regardless of where it came from, and Bypass imposes no signature checks. The exact policy in effect can also differ depending on whether it has been configured at the MachinePolicy, UserPolicy, Process, CurrentUser, or LocalMachine scope.
The fact that the script runs successfully from an elevated Windows Terminal suggests that the two PowerShell sessions are not actually using the same effective execution policy. Windows Terminal itself does not bypass PowerShell's security, but it may be launching a different version of PowerShell or one with a different execution policy in effect. For example, one session may be using Windows PowerShell 5.1 while the other is using PowerShell 7, or one may have a Process-level execution policy that overrides the system default.
If the script came from the Internet, another possibility is that Windows has marked it as having originated from an untrusted source. Even if the execution policy is set to RemoteSigned, PowerShell will refuse to run an unsigned script that still carries this "Mark of the Web." If you trust the source, you can remove that mark with the Unblock-File cmdlet or by opening the file's Properties dialog in File Explorer and selecting Unblock, if that option is present.
If your effective execution policy turns out to be AllSigned, then the error is expected because the script would need to be digitally signed with a trusted code-signing certificate. In that case, you would either need to change the execution policy to one that permits trusted local scripts, such as RemoteSigned, or ask the script's author to provide a properly signed version if your organization's security policy requires signed scripts.
If this is a personal computer rather than one managed by an organization, RemoteSigned is generally the recommended balance between usability and security. If the computer is managed by your employer, the execution policy may be enforced through Group Policy, in which case you should not attempt to circumvent it and should instead contact your IT administrator or the script's author for guidance.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin