Package Export - Out-GridView not working with PowerShell version 2.0 mode

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 11 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
Srinath
Posts: 111
Last visit: Tue Feb 09, 2016 12:12 pm

Package Export - Out-GridView not working with PowerShell version 2.0 mode

Post by Srinath »

Hello,

When I export my package using PS 2012 with PowerShell version 2.0 mode, the Out-GridView is not working. The development machine is running on PowerShell version 3.0 and has ISE too. .NET framework is up to date.

When I use the Out-GridView on both ISE and Shell, it's working without any issues. Why It's working if I export the script with PS 2012?

UPDATE: When I run the project directly on PS 2012 (engine is already set to user PowerShell version 2.0), the Out-GridView works. It's not working when I executed packaged script.

Error Message:
Out-GridView : To use the Out-GridView cmdlet, install the Windows PowerShell I
ntegrated Scripting Environment feature from Server Manager. (Could not load fi
le or assembly 'Microsoft.PowerShell.GraphicalHost, Version=1.0.0.0, Culture=ne
utral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system
cannot find the file specified.)

Any further help would be greatly appreciated. Thank you!
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Package Export - Out-GridView not working with PowerShell version 2.0 mode

Post by davidc »

I was able to reproduce the error with V2. Interesting enough it works with V3.

Do you have both versions of PowerShell installed?


David
David
SAPIEN Technologies, Inc.
User avatar
Srinath
Posts: 111
Last visit: Tue Feb 09, 2016 12:12 pm

Package Export - Out-GridView not working with PowerShell version 2.0 mode

Post by Srinath »

Yes.

Dev machine is running on Windows 7 ENT with SP1
.NET 4.5 with all updates
PowerShell v3.0 with ISE

I build the project with v2 dependency. On v2, I can't utilize -OutputMode property. So I only used -OutGridView property, but it's not working when I execute the packaged script.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Package Export - Out-GridView not working with PowerShell version 2.0 mode

Post by davidc »

I think this is isolated with V3 machine installed. I tested this on a V2 only machine and the Out-GridView works fine.

Note: There are a few bugs that are introduced into V2 after installing V3. We will look into further.

David
David
SAPIEN Technologies, Inc.
User avatar
Srinath
Posts: 111
Last visit: Tue Feb 09, 2016 12:12 pm

Package Export - Out-GridView not working with PowerShell version 2.0 mode

Post by Srinath »

I think this is a bug in PowerShell 3.0 engine itself! When I launch PowerShell with '-version 2' switch and try to access the 'Out-GridView' property, it gave me the same error message!
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Package Export - Out-GridView not working with PowerShell version 2.0 mode

Post by davidc »

Something must of changed recently. I reported this to Microsoft using Connect:

https://connect.microsoft.com/PowerShel ... -v3-update

David
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Package Export - Out-GridView not working with PowerShell version 2.0 mode

Post by davidc »

One more thing. Please run the following in PowerShell Studio in v2 mode:

$PSVersionTable

Is it showing V3 or V2?

David
David
SAPIEN Technologies, Inc.
User avatar
Srinath
Posts: 111
Last visit: Tue Feb 09, 2016 12:12 pm

Package Export - Out-GridView not working with PowerShell version 2.0 mode

Post by Srinath »

As per Microsoft response, it was a known issue in CTP2, but not sure whether is is by design or a bug!

http://connect.microsoft.com/PowerShell ... ersion-2-0
--------------------------------
PSVersion: 3.0
WSManStackVersion: 3.0
Serial....: 1.1.0.1
CLRVersion: 4.0.30319.17929
BuildVersion: 6.2.9200.16398
PSCompatibleVersions: {1.0, 2.0, 3.0}
PSRemoting...: 2.2
--------------------------------
User avatar
Srinath
Posts: 111
Last visit: Tue Feb 09, 2016 12:12 pm

Package Export - Out-GridView not working with PowerShell version 2.0 mode

Post by Srinath »

As per in release documentaion:

Running the Windows PowerShell 2.0 engine does not replicate the complete Windows PowerShell 2.0 experience.
•The interactive features of Windows PowerShell 2.0, including format files, help content, the Out-GridView cmdlet, and Windows PowerShell ISE, are replaced by their Windows PowerShell 3.0 versions.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Package Export - Out-GridView not working with PowerShell version 2.0 mode

Post by davidc »

I'm sorry to hear that, people still need to develop scripts targeting V2 machines. It would be nice if the Out-GridView actually worked despite the fact.

David
David
SAPIEN Technologies, Inc.
This topic is 11 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.