Many thanks for your replies.
I understand this seems a bit strange, so i’ll try and explain a little further.
I’m using a hta file to load an onclick button, once clicked it will run the powershell script. I know this is a long winded way of doing things but for the purpose of this experiment this is how it has to be.
I’m trying to prove that a script that should not be run in Powershell V2 can be, by simply downgrading the version.
I can successfully downgrade the version however when the script is appended to Powershell -Version 2 (script) it still runs in V5. UNLESS I manually load pwowershell, downgrade the version first and paste in the rest of the script in to that powershell prompt window. This then works as it should and it’s ran from with-inside V2.
So my question is, why doesn’t this work in the first instance and how can this be overcome? Is there a way to read in the rest of the script once Powershell is downgraded automatically?
Hope this clears things up.
I also know V2 shouldn’t be used, all the security issues associated with it and such, however as mentioned this is purely experimental and I would like to understand what’s going on.