Unhandled exception: to use the Out-Gridvew cmdlet

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 7 years and 8 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
LtMandella
Posts: 61
Last visit: Mon May 07, 2018 4:03 pm

Unhandled exception: to use the Out-Gridvew cmdlet

Post by LtMandella »

Product, version and build: powershell studio 4.2.99
32 or 64 bit version of product:64
Operating system:win server 2008 r2
32 or 64 bit OS:64
PowerShell Version:3

For unknown reason, running a .psf winform app that uses Out-Gridview cmdlet from within powershell studio now gives me the below error. Up until today, never had any problem with out-gridview in winforms app running from pshell studio...
--------------------------------
Unhandled exception...

To use the Out-Gridvew cmdlet, install the windows powershell integrated scripting environment feature from Server Manager (Could not load file or assembly "Microsoft.Powershell.GraphicalHost,version=1.0.0.0., blah, blah, blah...

If I recall correctly, recently pshell studio automatically started an update that I didn't want to perform (I'm right in the middle of a huge project) so I cancelled as soon the update process would respond.

Is my powershell studio environment trashed now?
User avatar
LtMandella
Posts: 61
Last visit: Mon May 07, 2018 4:03 pm

Re: Unhandled exception: to use the Out-Gridvew cmdlet

Post by LtMandella »

I should add that if I export the exact same form, and execute the .ps1 file directly with powershell, the app runs fine, displaying the Out-Gridview without error...
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Unhandled exception: to use the Out-Gridvew cmdlet

Post by davidc »

Please make sure that you don't have V2 platform selected instead of V3.
Platform Settings.png
Platform Settings.png (12.98 KiB) Viewed 2689 times
The cmdlet will not work in V2 if it is installed side-by-side with V3:

https://www.sapien.com/blog/2012/12/21/ ... v3-update/
David
SAPIEN Technologies, Inc.
User avatar
LtMandella
Posts: 61
Last visit: Mon May 07, 2018 4:03 pm

Re: Unhandled exception: to use the Out-Gridvew cmdlet

Post by LtMandella »

thanks, I guess that is the problem.

$PSVersionTable shows I have version 3 on my dev vm.

However, there is no option available in my pshell studio to select version 3.

only version 2, 64 or 32 bit.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Unhandled exception: to use the Out-Gridvew cmdlet

Post by davidc »

Try the following:

1. Run RegisterControl.exe, check all available options and press OK:

C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2016\RegisterControl.exe

2. Refresh the Cache in PowerShell Studio:
Refresh Cache.png
Refresh Cache.png (33.03 KiB) Viewed 2541 times
After the caching process completes, the V3 platform should be available.
David
SAPIEN Technologies, Inc.
User avatar
LtMandella
Posts: 61
Last visit: Mon May 07, 2018 4:03 pm

Re: Unhandled exception: to use the Out-Gridvew cmdlet

Post by LtMandella »

I do not see that "refresh" icon in my 2015 version of pshell studio but it seems like it refreshed itself because the v2 and v3 choices are visible now in the dropdown.

thanks again for your help!

ken
This topic is 7 years and 8 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.