Page 1 of 1

Get-Package is not working in Forms

Posted: Tue Mar 10, 2020 7:33 am
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:

Re: Get-Package is not working in Forms

Posted: Tue Mar 10, 2020 8:38 am
by Alexander Riedel
getpackage.png
getpackage.png (13.59 KiB) Viewed 1619 times
Appears to operate fine.

$button1_Click={
#TODO: Place custom script here
$textbox1.Text = Get-Command get-package | Out-String
}

Re: Get-Package is not working in Forms

Posted: Fri Mar 13, 2020 6:43 am
by dakotazinn
I believe this only seems to be an issue when PS 5 is installed SxS with PS 7

Re: Get-Package is not working in Forms

Posted: Fri Mar 13, 2020 7:28 am
by Alexander Riedel
Give it a few days and we can test this with PS 7.