Powershell v7.1 Code will not run

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

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 years and 2 months 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.
User avatar
agmulanax
Posts: 8
Last visit: Thu Feb 29, 2024 6:05 pm

Powershell v7.1 Code will not run

Post by agmulanax »

RE:Powershell Core Console wont execute
Post by coryjiggens » Fri May 15, 2020 3:47 pm

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***
Product: PowerShell Studio 2020 (64 Bit)
Build: v5.7.182
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.19041.0

Powershell 7.1.0-rc-2

*** Please add details and screenshots as needed below. ***
If I run a script in PowershellStudio with or without a Winform construct no errors are returned but the script closes without running the code. No form is presented or results returned to the output screen (Tested using write-host.)

If a script is run in the console the error attached is returned.

If the surrounding ' "mj." ' and ' '' mj' are edited out of the command string, the scrip will act as expected.

If the script is exported to a file and then ran the script acts as expected

PowerShell 5.1 appears to be unaffected

V7ConsoleError.png
V7ConsoleError.png (73.79 KiB) Viewed 2302 times
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 8:47 am
Answers: 39
Been upvoted: 30 times

Re: Powershell v7.1 Code will not run

Post by brittneyr »

Please try resetting your consoles in Options:
SPS-ResetConsole.png
SPS-ResetConsole.png (36.88 KiB) Viewed 2296 times
Brittney
SAPIEN Technologies, Inc.
User avatar
agmulanax
Posts: 8
Last visit: Thu Feb 29, 2024 6:05 pm

Re: Powershell v7.1 Code will not run

Post by agmulanax »

The test script is 'write-host "Hello World"'
Using the command string below. PowerShell fails to load the shell
'D:\Program Files\PowerShell\7-preview\pwsh.exe -noexit Remove-Module PSReadline -ErrorAction Ignore'


'D:\Program Files\PowerShell\7-preview\pwsh.exe -noexit' Will load the shell but does not remove the 'mj' header / footer from the command string in the console.

Running the script returns the following in the Output panel.
Run
V70Output-PostModification .png
V70Output-PostModification .png (7.71 KiB) Viewed 2213 times
Run Selected
V70Output-PostModification .png
V70Output-PostModification .png (7.71 KiB) Viewed 2213 times
Attachments
Powershellv7Output-Postmodification.png
Powershellv7Output-Postmodification.png (20.88 KiB) Viewed 2213 times
V7Oustput-Selected.png
V7Oustput-Selected.png (61.36 KiB) Viewed 2213 times
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 8:47 am
Answers: 39
Been upvoted: 30 times

Re: Powershell v7.1 Code will not run

Post by brittneyr »

PowerShell 7.1 is not currently fully supported as we do not generally support preview versions. We do allow you to make a console with preview versions and run scripts through the Console panel, but you should not be able to run directly though PowerShell Studio and see results in the Output panel. There was a bug reported by another customer about this behavior not working as expected. We have filed a bug report for that and it should be fixed in the next service release.

When you have V7 selected from the ribbon, it is running the latest stable version of PowerShell 7.0.3:
SPS_Platform.png
SPS_Platform.png (26.65 KiB) Viewed 2189 times
Please verify the you have PowerShell 7.0.3 installed. You should be able to have a preview 7.1 release and 7.0.3 installed side-by-side.
Brittney
SAPIEN Technologies, Inc.
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 8:47 am
Answers: 39
Been upvoted: 30 times

Re: Powershell v7.1 Code will not run

Post by brittneyr »

Support for PowerShell 7.1 has been added to service release 5.8.183.
Brittney
SAPIEN Technologies, Inc.
User avatar
agmulanax
Posts: 8
Last visit: Thu Feb 29, 2024 6:05 pm

Re: Powershell v7.1 Code will not run

Post by agmulanax »

Thank you for the update
Installed latest version of Powershell Studio.

I am still having each line of text in the editor inserted between ' mj' ('<space>mj') when using <F8> to run the whole or selected parts of the script . I also have Primal Script 2021 installed on the same computer. Primal Script works as expected with Powershell 7.


Product: PowerShell Studio 2021 (64 Bit)
Build: v5.8.183
OS: Windows 10 Pro (64 Bit)
Build: v10.0.19041.0

Name : ConsoleHost
Version : 7.1.0
InstanceId : 4ba7730b-3f0c-4074-ac01-7f78aae66923
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
This topic is 3 years and 2 months 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.