Get-Package is not working in Forms

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.
Locked
User avatar
dakotazinn
Posts: 20
Joined: Thu Apr 13, 2017 8:00 am

Get-Package is not working in Forms

Post by dakotazinn »

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.173
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.18362.0

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



'Get-Package' is not working properly when run from a Form application.

It IS working when running the selection from the console.
I also tested this by creating a new form and setting the load event to "Get-Command Get-Package" (The only code in the whole form), and it still throws.

Code: Select all

ERROR: Get-Command : The term 'Get-Package' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
ERROR: if a path was included, verify that the path is correct and try again.
TestForm.psf (3, 2): ERROR: At Line: 3 char: 2
ERROR: +         Get-Command Get-Package
ERROR: +         ~~~~~~~~~~~~~~~~~~~~~~~
ERROR:     + CategoryInfo          : ObjectNotFound: (Get-Package:String) [Get-Command], CommandNotFoundException
ERROR:     + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
ERROR:

User avatar
Alexander Riedel
Posts: 7406
Joined: Tue May 29, 2007 4:43 pm

Re: Get-Package is not working in Forms

Post by Alexander Riedel »

getpackage.png
getpackage.png (13.59 KiB) Viewed 642 times
Appears to operate fine.

$button1_Click={
#TODO: Place custom script here
$textbox1.Text = Get-Command get-package | Out-String
}
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
dakotazinn
Posts: 20
Joined: Thu Apr 13, 2017 8:00 am

Re: Get-Package is not working in Forms

Post by dakotazinn »

I believe this only seems to be an issue when PS 5 is installed SxS with PS 7

User avatar
Alexander Riedel
Posts: 7406
Joined: Tue May 29, 2007 4:43 pm

Re: Get-Package is not working in Forms

Post by Alexander Riedel »

Give it a few days and we can test this with PS 7.
Alexander Riedel
SAPIEN Technologies, Inc.

Locked