Monthly Archives: August 2014

PowerShell Tools for Visual Studio 2013 – unable to run and/or debug PowerShell script – execution policies problem

The problem :

Some time ago I wrote this article :

http://rostacik.net/2013/11/13/powershell-tools-for-visual-studio-2012-problem-ps1-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system-for-more-information-see-about_execution_policies

about my problems running and debugging PowerShell scripts in VS 2012 with help of http://visualstudiogallery.msdn.microsoft.com/e3f9d3bf-e630-4b3e-968a-f86ac67b836c – PowerShell Tools for Visual Studio 2012 – wonderful tool by Adam Driscoll.

Currently after switching to Windows 8.1 + VS 2013 I reopened my project and started to work with new version of PowerShell Tools for Visual Studio 2013 – http://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597

And  I was shocked! The very same problem got even worse! I wasn’t able to fix this with steps in the article. I was able to edit scripts in VS but still, I wasn’t able to debug my stuff. After some messing with other stuff I found out, that the very same problem was here some time ago and is already fixed by another people – with help of this link : http://davidfrette.wordpress.com/2011/01/20/creating-powershell-pre-build-and-post-build-events-for-visual-studio-projects/ (yes, it was the same back then in 2011)….

Solution to the problem is quite simple :

PowerShell installs in one package however there are two versions : x86 and x64 (as separate executables that I had to find on my drive) and as you might guessed correctly : they don’t share the same Get-ExecutionPolicy setting!

So you need to :

  • Find x64 version of PowerShell
  • set ExecutionPolicy

On my machine while running VS2013 as 32b executable :

vs 2013 32b

And with the starting position like this (please note that there is no difference in title bars, you only can tell what PS you are using by the path):

ps two versions

 

I Set-ExecutionPolicy to RemoteSigned like this :

ps two versions 64 fixed

 

and the output in VS 2013 changed from this :

vs ps error

 

to this :

vs ps fixed

 

No PowerShell package on my box in add/remove programs :

I have to state 1 small thing at the end, I didn’t installed PowerShell on my box as a downloaded .exe file.  If I search my installed programs, I see this (nothing) :

ps uninstall

 

While I can see PowerShell 2.0 in add/remove feature in Windows 8.1 like this :

ps feature

So your box setup may vary. If so, please comment below for others… Thank you! 🙂

Hope this helps/saves you some time….

How to convince Internet Explorer to show more pages with untrusted cerificates in one tab (iframed)

Funny article name you say and I can only agree, yes 🙂 most of the time you run like hell when you see page with broken certificate. But I will explain why one might need this 🙂

My girlfriend is a tester and at her current work she is testing web apps. Since majority of these apps use SSL and she is using staging versions, she has to accept certificate errors and if you know what you are doing, than everything is OK and fine (you see errors because of self signed certificates).

Yes there are more ways how to get over this problem :

but if you don’t want to do this/you cant do this on your box then you just have to live with basic temporary exception and you will click Continue to this website :

ie certificate error

And now comes the problem part/our edge case. Most of the time you are accessing one URL on one server and everything works.

But lets say you have your testing URL with self signed certificate where is a page with IFRAME to different URL with different certificate on different server. Now what? You have to add two different exceptions.

The problem lies in how IE (tested in IE11) displays another page. You just don’t have any option how to add another exception, you just see that the iframed page has invalid certificate, nothing more…

The FireFox solution :

The FireFox way is more common and most of people know it (so just small recap):

you can open new tab with IFRAMEd URL, access it, see error and add permission. Than on another tab access hosting page, add second exception and you are done, all of the later visits to hosting page share the same exception. Which is nice, because you can close the tab and open different one later and you don’t need to add exception to IFRAMEd URL over and over again.

The IE (I suppose because of the architecture – more on this here – http://blogs.msdn.com/b/ie/archive/2008/03/11/ie8-and-loosely-coupled-ie-lcie.aspx ) behaves little bit differently.

The IE solution :

In IE the exception for IFRAMEd page isn’t shared between tabs/shared for whole browser instance so you have to :

  1. Access the IFRAMED URL and add exception and then on the very same tab
  2. Access the hoster URL and add second exception

and everything should work now also for IE the way expected 🙂 but once you close the tab with exceptions, you have to do the same thing again…

Decision which way is better/safer is up to you….

Hope this helps 🙂 Tested on latest versions of Windows 7 + IE11.