Just starting to learn.
Why does the PowerShell.exe -Version 2.0 command "hang" when executed in PowerShell_ISE ?
From trial-and-error, the console is the choice to work with version 2.0 ?
Since you are saying, you are just starting to learn. It is really important that you get a good baseline understanding before you unnecessarily frustrate yourself. See the plethora of examples / options below.
Are you saying, you are in the ISE, and then going to the ISE output / console Window and trying to change the ISE session to v2?
That's really not a thing you can do. You put the version in your script not like what it seems like you are trying.
The ISE console is not for interactive console commands (.exe, etc). So, cmdlets and scripts only, PowerShell, as you are using it is calling the powershell.exe console host and it expects user interaction, just as Nslookup, etc would.
What are seeing has nothing to do with v2, but everything to do with calling an interactive command line tool.
$psUnsupportedConsoleApplications wmic wmic.exe cmd cmd.exe diskpart diskpart.exe edit.com netsh netsh.exe nslookup nslookup.exe powershell powershell.exe
You can run them, but you have to pass all possible parameters needed. Again, no interactive keyboard stuff with allowed.
So, if you are writing script that require you use v2, then you have to ensure you only use v2 code in your script and use the -version check in the script itself.
I am starting to learn that is why I am here asking questions looking for answers that clarify my questions and not ones that make things more confusing. I have Don Jones's text and I am asking questions based upon text within his book.
I do not need to be bombarded with education resources. I have Don Jones' text and I am focused on learning the fundamentals using only that text and getting answers to my questions here.
I just need very specific answers to very specific questions that I am asking based upon what I am seeing in that single text.
ISE is not for interactive use. I do not understand "interactive."
See my updates, and no that link is still live. I always check links before I post them.
Interaction, means, that after you type *.exe command, it will either spit out a result or expect something else from you in order to continue. Hence interaction. Since you are already in the ISE PowerShell console, you cannot use the powershell.exe console in the ISE console. They are two different environments.
Simply put, you can't use .exe/.com/.bat, etc., commands in the ISE console host, that prompt for you to do something.
Try it. Restart the ISE, and in the ISE console, type nslookup. The same this will happen. Then start just the default powershell.exe console and type nslookup again, and see the difference.
If you want to use a scripting editor that allows you to use the full powershell.exe console, vs the ISE console, download and use MS Visual Studio code instead of the ISE.
ISE and VSCode have their strengths and weaknesses, you have to try both and choose which works for you best.
See this article.
postanote – thank you much for your answers. The explanation of "interactive" was most helpful.
Absolute n00b. And when I say that I mean Windows Home n00b – as in a very basic Windows user. At the bottom. There's only one direction. Up.
PS – I followed your advice to grab Don Jones' book "Learn Windows PowerShell in a Month of Lunches". And that is where I am starting.
No worries. Welcome to the Windows and PowerShell. This will be a journey for you. Frustration will abound, but all learning is about try/fail/recover/continue. After more than 4+ decades doing this stuff, that try/fail/recover/continue, is still and will always be a thing we have to deal with.
As far as the educational bombardment. I been delivering IT PRO / Developer / Security course (well outside of my day job) since the 1980's and I am a firm believer in never just use one source. The sources I listed are the info I give all my PowerShell / Infrastructure students at the very beginning of the class and remind them of it again at the end.
So, not trying to overload you, but just an edification. PoSH is very powerful and you should have various resources to gain as much insight as you can. Listening to only one voice is limiting your full breath learning achievements.
Don's book is one of the better ones for beginners, but should not be your only source. BTW, the youtube videos I point to include the video companion from Don's book. Ther direct link to Don's vids for his book is this:
Yet, as a new Windows user, it's important that you look at some beginning Windows / Windows admin vids as well, so, the stuff you use via PoSH will make more sense.
You will also not, Don really does not like the ISE. He lives in the powershell.exe console host and refers to the ISE only when talking to script writing / tool making, graphical user interface development, well that and notepad, for some reason only he knows. 8^} The ISE is my notepad. I've even set it as my default vs notepad. When I need to hit the console host, I just shell out to it as needed from within the ISE. Meaning, my code / commands are in the ISE script pane, but if I need to run it in the console host, I just call that from my script code, it runs, closes and returns me back to the ISE, where I continue my work.
You'll either end up accepting / following how someone else does things, or you will devise your own way to come to grips and use all you are after. I have chosen the latter. Yet, I still read / re-read many of the resources I pointed to as well as follow the authors blogs and more. It's the only way to stay current and aware.
Again, welcome. Good luck and take care.
postanote – I don't disagree with anything you are advising. It's just that I'm at the stage where I'm the proverbial four-year old learning the alphabet. I'm really trying to focus on learning the fundamentals before branching out. With my own personal style of learning in the beginning, I have to focus on mastering the fundamentals. If I bounce around at this point, I will flake out. Personally I'm really big on mastering the basics – the fundamentals. That's just my style. So at this point I'm just focusing on the Jones-Hicks book and companion videos. Learn what's in it – back-and-forth\upside-down – precisely because it is stuff that is as basic as it gets. Later on I will look at the broader picture and build upon the fundamentals. I'm older. I have tunnel vision right now. It's just my focus at this point and not an intent on my part to exclude the vast, rich material that is out there.
The whole thing with the ISE was just to explore it as a lab exercise at the end of Ch. 2 in the Jones-Hicks text. And the text briefly mentioned that PowerShell V2 can be run. So not knowing any better I tried to do it in both the console and in ISE. "Learn by doing."
Anyway, you answered my question and I am grateful for the clarity you provided.
It is precisely because there is help – actually in this very community, PowerShell.org – that I decided to learn PowerShell.
You must be logged in to reply to this topic.