cannot instantiate PowerShell object

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
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.
User avatar
Posts: 134
Joined: Thu Oct 26, 2006 7:00 pm

cannot instantiate PowerShell object

Post by FrankAndrew » Tue Jan 26, 2016 6:13 am

Product, version and build: PowerShell Studio 2015, 4.2.99
32 or 64 bit version of product: 64bit
Operating system: Windows 7 Enterprise Service Pack 1 [6.1.7601]
32 or 64 bit OS: 64 bit

To whom it may concern,

I am having the same problem as others have had that PowerShell Studio 2015 cannot see the installed versions of powershell that are present.

The big problem that I am having is that I have a PS1 script that runs fine in PowerShell Studio 2015 using what appears to be powershell v2 but when I run the same exact script in the powershell.exe where up to v4 is available it gives me different results. That makes debugging all the more difficult.

I have read two of the threads in this Forum about this problem.

I have tried the five steps mentioned in the "last update broke my PS" thread to no avail.

Attached is a ZIP file with various screenshots of what my "normal" user can see and what a Local Admin user sees on the exact same machine.

Any help here would be appreciated greatly so that I know what needs to be done when PowerShell Studio 2015 can't see what it should be able to see.
(141.15 KiB) Downloaded 130 times

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

Re: cannot instantiate PowerShell object

Post by Alexander Riedel » Tue Jan 26, 2016 7:31 am

If the v3/V4 component is not registered properly, you will get this error message.
There are too many screenshots there for me to understand what you are trying to show. PrimalScript and PowerShell Studio share the PowerShell components and the debugger, so you will always see the same results in both products. So there is no need to post PrimalScript screenshots for a PowerShell Studio problem or vice versa.

There are a few reasons the v3/v4 component is not registered. Usually you have missing .NET runtimes
or a botched installation. Windows installer is not always perfect, so that can happen.

Reboot the machine, reinstall PowerShell Studio. If the problem persists, register the
components manually from the command line (with elevation)

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>RegAsm.exe "C:\program files (x86)\common files\sapien debugger 2015\pwshhelpctrl2015v3.dll" /codebase


C:\Windows\Microsoft.NET\Framework\v4.0.30319>RegAsm.exe "C:\program files (x86)\common files\sapien debugger 2015\pwshhelpctrl2015v3.dll" /codebase

Ignore any warnings, please report any errors.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Posts: 134
Joined: Thu Oct 26, 2006 7:00 pm

Re: cannot instantiate PowerShell object

Post by FrankAndrew » Sun Feb 07, 2016 11:32 pm

Hi Alex,

It was the requirement that the RegisterControls.exe MUST be run after an Update/Installation/RE-Installation that was the cause of my problem.

I did not know that this is an absolute MUST.

If I had NOT let that (RegisterControls.exe) run the first time the program (PowerShell Studio in this case) was started after an update/install/re-install procedure then I would definitely have this problem.

Thanks for the details.