Function not working within app

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 1 year and 5 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
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Function not working within app

Post by localpct »

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 2022 (64 Bit)
Build: v5.8.208
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.19044.0

*** Please add details and screenshots as needed below. ***

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

I apologize if this is in the wrong forum but it appears it's only related to PowerShell Studio.

When I paste https://github.com/jaapbrasser/SharedSc ... rogram.ps1 into a ps1 or PSF within PSS, I get this error. I've used this code on and off since it's inception but never a need within your application. I just tested this within ISE, VSCode, and Powershell cmd line.

Any thoughts?
temp.png
temp.png (56.82 KiB) Viewed 4459 times
User avatar
Alexander Riedel
Posts: 8488
Last visit: Mon Apr 15, 2024 3:28 pm
Answers: 20
Been upvoted: 37 times

Re: Function not working within app

Post by Alexander Riedel »

This looks like an error from the syntax check, which, albeit done via PowerShell, may deliver a different result than actually running the code.
Does the code run from within PowerShell Studio or not?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Function not working within app

Post by localpct »

Thanks for the reply. It does not, this is what displays in the Output tab

Test10.12.2022.psf (129, 11): ERROR: At Line: 129 char: 11
ERROR: + [int]# This parameter only works when Exclude ...
ERROR: + ~
ERROR: Parameter declarations are a comma-separated list of variable names with optional initializer expressions.
ERROR:
Test10.12.2022.psf (129, 11): ERROR: At Line: 129 char: 11
ERROR: + [int]# This parameter only works when Exclude ...
ERROR: + ~
ERROR: Missing ')' in function parameter list.
ERROR: + CategoryInfo : ParserError: (:) [], ParseException
ERROR: + FullyQualifiedErrorId : InvalidFunctionParameter
ERROR:
User avatar
Alexander Riedel
Posts: 8488
Last visit: Mon Apr 15, 2024 3:28 pm
Answers: 20
Been upvoted: 37 times

Re: Function not working within app

Post by Alexander Riedel »

Which PowerShell version exactly are you running this with?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8488
Last visit: Mon Apr 15, 2024 3:28 pm
Answers: 20
Been upvoted: 37 times

Re: Function not working within app

Post by Alexander Riedel »

I see the problem. The PowerShell Studio automatic formatter creates an error by pulling the variable name up in the comment.
I will get the development team to look at that as soon as possible.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Function not working within app

Post by localpct »

Thanks so much, I appreciate your quick response.
PSVersion 5.1.19041.1682
User avatar
brittneyr
Site Admin
Posts: 1669
Last visit: Fri Apr 12, 2024 2:35 pm
Answers: 39
Been upvoted: 31 times

Re: Function not working within app

Post by brittneyr »

Please try service build 5.8.212 and let us know if this is still an issue for you.
Brittney
SAPIEN Technologies, Inc.
This topic is 1 year and 5 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.