PowerShell ISE (Integrated Scripting Environment) Basics

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

If you're just learning the basics, you'd be better off starting on Code which is MS's recommended platform now that ISE is retired.

๐Ÿ‘๏ธŽ︎ 75 ๐Ÿ‘ค๏ธŽ︎ u/iceph03nix ๐Ÿ“…๏ธŽ︎ Aug 24 2020 ๐Ÿ—ซ︎ replies

Yeppers, ISE not going anywhere. It's part of the OS, therefor always at hand. Unlike VSCode.

It still, my primary goto for daily work. I have it heavily customized, and many of my customizations don't work in VSCode or are more work to use). Lastly, especially when I am customer sites that will not install other stuff, period.

Major PS projects are Sapiens PS, VSCode (mostly because of cross-platform use cases and training others), and Visual Studio Ent.

Dev should be using VSCode, which was it main target on release, and until MS ships VSCode in the box (and they should to not only replace the ISE but notepad as well), it will not be on any enterprise-level server and not in data centers. Well, not with any customer I've supported to date. So, anyone, discouraging the use of ISE is just not prudent at all. Except in the personal standalone use case or developer.

Only since MS has been pushing VSCode has the normal admin been seeing it come up. Well, that many of the PS MVP and other presenters using it and also key for any PSCore stuff cross-platform.

๐Ÿ‘๏ธŽ︎ 17 ๐Ÿ‘ค๏ธŽ︎ u/get-postanote ๐Ÿ“…๏ธŽ︎ Aug 25 2020 ๐Ÿ—ซ︎ replies

ISE and Powershell 5.1 still come with Windows 10, so they're hardly obsolete. I still use the ISE sometimes when I want to copy and paste unicode characters. Although my editor is usually Emacs.

๐Ÿ‘๏ธŽ︎ 3 ๐Ÿ‘ค๏ธŽ︎ u/jsiii2010 ๐Ÿ“…๏ธŽ︎ Aug 25 2020 ๐Ÿ—ซ︎ replies

ISE is much simpler to use then VS code. Maybe if code got a better toolbar.

๐Ÿ‘๏ธŽ︎ 4 ๐Ÿ‘ค๏ธŽ︎ u/linkdudesmash ๐Ÿ“…๏ธŽ︎ Aug 24 2020 ๐Ÿ—ซ︎ replies
Captions
[Music] all right so let's go ahead and open up the powershell ise ise standing for integrated scripting environment and i'm just gonna go to the start menu type in powershell so you can see that there's of course your typical powershell prompt but there's also powershell ise so that's the one you want to open up now i think by default if it's the first time you're starting a powershell ise the powershell prompt will have 100 of the screen for some of you it might be different but if it is like this you can go ahead and open up the script pane by going to this little arrow pointing down where it says script and this is uh if you hover over it it says show script paint so click on that and obviously i've resized my font to make it easier for you guys to see this but unfortunately for the window itself i really haven't been able to figure out how to change the font size so i apologize for that so in this area this is where you actually would type in your script and the bottom here will be the area where you can run your powershell commands and also it shows the output of the script you're running if i go to view and click on show command add-on i think you guys can better see this now but on the right-hand side this uh commands pane gives you a list of all the modules that you currently have installed this one this might look different for you of course but if you click on the drop down menu where it says all it shows you all the powershell modules that are available for you to use in this vm i the only thing i've installed is all my posh and poshkit modules but otherwise this is a default vm with all the default modules that come with windows 10. so below the modules if it shows you all the commandments that are available to you okay there's a lot of them so you're also provided with this field here where you can partially type in the command name and then it searches for you as you're typing so for example get dash will list all everything all the commandlets that start with get dash but let's start typing more so as you start typing more it reduces the search result so here we have get child item now you notice that when i click on it on the bottom down here says to import the microsoft power powershell management module and its commandlets including get child item click show details so what this means is in this session right now that i have for powershell ise it's currently not importing any of the modules so i have to click on if i want to be able to see how to use this command lit i need to click on show details so now once i click on that then it gives me all the details for this commandlet and what i mean by details i mean parameters so if i if i were to use the get child item commandlet there are all these uh parameters that i can use when i run it the ones that are denoted with us asterisk are the ones that are required get child item doesn't have any required parameters so none of these have a asterisk next to them so going back over here to the script pane you'll see there's a number one here there's uh that means that these are line items so as you're typing your script out and you're going to the next line the numbers will keep on incrementing based on the number of lines that you've typed in and if you notice down here at the bottom right you're also told what line number your your cursor is on right now so i'm on line one column one that's because i haven't typed anything in so let's go ahead and try something simple right now just so that we can enable more buttons from the toolbar and i can show you some of the stuff from the toolbar so i'm going to click on get child item and down here at the bottom right i'm going to click on copy and what that does is it's gonna copy the command lit and any parameters i've chosen none so it's just gonna be kid child item and then i can paste it in here and you can see that now i have the beginnings of a script i have a single command but it's the beginnings of a script and when i did that if you paid attention now the run script button on the toolbar has become enabled and so has the run selection we'll get into the difference between these two in a bit but let's go ahead and run our script we essentially have a script now how do we know that well if you look at the tab name it automatically gives it the name untitled1.ps1 ps1 denoting that this is a powershell script and untitled because i haven't saved this so let's go ahead and run it and you'll notice down here there's some output right so what does get child item do if you run it in a directory it gets all the contents of a directory it's not the only thing it does in the future we'll go over other uses for it but for this video just know that that's what it does so we can see here that we went over here to the commands pane picked out a command lit look at the different parameters we copied it paste it into the script pane and then we ran our script without saving it we ran our script without saving it and it ran it and it showed output in the powershell command prop below it okay so let's go ahead and do something else let's add on to this script let's say i wanted to get all the directory listings for a particular directory right now i'm not specifying a directory so when i run it it's running against the directory that that i'm currently in in the powershell prompt but let's go ahead and specify a directory and what i'm going to do is i'm going to use a tilde the tilde just denotes that it's my home directory that when i have to provide the whole path and then i'm gonna do a backslash and you notice that when i do a backslash this menu pops up this is uh intellisense and what intellisense does is it as you're typing things in especially with commandlets for example a parameter it it starts giving you options that that are available for that commandlet or in this case it also allows you to navigate to different directories so i'm going to scroll down here i'm going to click on documents and you notice that it automatically gave me the full path so let's go ahead and run this i'm not saving it i'm just running it and now when i run it it says get child item and then down here it tells you the directory that i'm running it against because it's now specified gives you the contents and the only thing in that directory is my windows powershell subdirectory okay well what else can we do this well let's actually go back over here and then say c colon backslash that should give us the root directory of the c drive so let's go ahead and run that and we see that now the output has changed down here let's go ahead and now start typing windows because i want to see the contents of the windows directory and you'll see that now it gives us again more output but it not only gives us directories but also files and there are file sizes as well as file attributes on the left hand side so we look at the right hand side over here and we can tell it whether or not we want only to list directories or whether we want to list files we're given options to list files with specific attributes and so on and so forth we can list things recursively so we're given all kinds of options right well for this i just want to go ahead and just start put a dash and you notice that when i do a dash that tells powershell that i'm about to use a parameter it gives me a list of the different parameters that are available for this command link so i'm going to say let's see let's scroll down here there were different things recurse file let's say i only want to list files i don't want directories so let's click on that and now it says dash file let's run our script and if we scroll back up over here we see that the only thing listed are the files not the directories in this subdirectory right okay let's uh do something else with this let's expand on this script so let's go ahead and assign this to a variable and so whatever the output of this is it will assign it to this files variable let's go ahead and run it we see no output because it's assigned it to files but if we go down here to the powershell prompt and we type in dollar sign files you'll notice something else going on again intellisense will pop up even in the powershell prompt as soon as i typed in the dollar sign you notice that it listed all the variables that are available for me but as i'm typing it's trying to show me what is the variable that i'm that it matches the most with in this case it's files so if i hit enter we see that there's the output which is what we were expecting so if i do this if i hit enter and i create a new line we'll see that if we run the script now it shows us the output another thing to note is that now that we're in a second line you'll see that the line number is now at two and how do we else know that down here at the bottom right it shows us that we're on line two column seven and that's where our cursor currently is line uh column seven so now if i put in if i type in a dot again intellisense comes up and it gives me the different members of this object because this file's variable is is more than just a variable now it has converted into a object so now if we wanted to do something else with this we could just click on any of these so for example let's say if we do for each you notice that it tells you expression arguments etc so it starts giving you the different options for this or you can go down here type in dollar sign files and then a pipe [Music] and then type and then type in get member and you can see what else is available files has a property called full name and let's say i wanted to know the full path for each of the files in that windows directory then i can just type in dot full [Music] name [Music] and let's say i didn't want to run the full script i just want to run this line that's where this other toolbar button is good for and that's one called uh run selection if i don't select actual text it'll only run that particular line so if i click on run you'll see that now it's listed all the files in that directory only the files but the full path because i told it right now that i wanted the full name but you can also select particular parts of a script and then click on that run selection button of course we're going to get the same output but there's two different ways again if you just click on a particular line it'll run the entire line or you can select a particular snippet of a script and run it so what are the different options that we see of course you're going to have the new file open file save file and all that there's the copy and paste i already showed you how to run the script how to run from selection also if you want to connect remotely to a windows machine that's on your network you can also connect remotely to it by clicking on here on the new remote powershell button and then you would type in the hostname of the machine and then of course your credentials and of course there's the different views so you can click on this view which i don't like but i guess some of you might like having the powershell prompt on the left hand side or you can do a complete script pane if you have a lot of stuff you want to work on first before you view the powershell prompt i usually just have the powershell pump all small over here just so that i can continue working with it let's explore the commands pane a little further down here so earlier you saw me selecting a the get child commandlet not picking anything out from here and just saying copy but there's two other buttons there's one called run and one called insert uh if you were to just click on run it's only gonna run the commandlet right and it's running it against this directory user my my home directory actually because i didn't specify anything right it's just saying get child item and whatever current directory i'm in that's what it's going to run in uh but there's other options as well let's say i want to say give me only directories i can check that off and hit run and it's going to go ahead and only give me the directories let's say i wanted a depth of two directories so then it will include not just the top level directory but the sub directory let's click on that and you'll notice that now it gave me that so under my home directory i have a pictures folder and under that pictures folder is a camera roll save pictures and all that okay so you can do that as well and then down here there's another button called insert if you click on that you'll notice that in the powershell prompt it inserted the full command here so you can see that here's the depth the depth and then the directory parameters that i selected over here on the right hand side but let's say i wanted to add this to my script i could go in here erase this here and then i'm gonna click on copy and then i'm gonna paste it in here and there you go get child item depth of two directory and then it's gonna assign it to files so let's go ahead and run this script and now it's running it and here's the output okay so you can use this commands pane to build commands and their parameters and then you can copy them over or you can test them out before you copy them over in the powershell prompt there's going to be all kinds of different options for parameters depending on what the command lid is that you've selected um let's click on add-ons because you know you're quickly going to realize that there's not a whole lot of stuff you can do aside from what i've already shown unless you go unless you add some more add-ons to this so if you go to add-ons open add-ons website [Music] you can see that in this website you can install all kinds of um add-ons to powershell ise a menu generator spell checker a regex tool but i wouldn't say there's a whole lot of them i'm not sure if there are other places i have never really to be honest with you explored you know adding on a whole lot of uh add-ons to my powershell ise simply because i like the way it works just as is and like i said whenever i'm already done with my initial scripts and i checked them into versioning i switch over to visual studio code which i believe eventually will replace this but for now it's still my go-to place so i don't really mess around with it too much but just know that that's something that you could do is you can go to the add-ons if you want so what other tools do we have if you go to tools options you could change the font you can customize the look and feel of this there's uh themes you can choose to change the look and feel of the isc so let's say we do that one the dark console dark editor monochrome green you want to really go old school i tend to leave mine in the default just because so another thing to note is that in powershell ise the powershell prompt that you're given below it's gonna have a different profile than the standard one that you have in your powershell command prompt and if we just type in dollar sign profile you'll notice that it has a different path powershell ise profile dot ps1 and that's so that you can customize the profile separate from your typical powershell prompt personally i like to have it be the same as my standard one so usually i'll create a sim link to it so that way they're they look the same because i like consistency across my powershell prompts uh but just know that take note that you would if you for example customize your your standard powershell prompt uh profile and then you open up powershell isc you might notice that you know it doesn't look the same and that's because it's using its own profile so another thing that i wanted to show you was of course how to debug a script and it's also a common feature with other integrated development environments so it's not that much different here which is to be able to use uh this debug here so for example let's say i wanted to test my script up to this point here to line eight then i can just right click in here click on toggle breakpoint okay now what this is going to tell powershell ise is go ahead and run this script up to this point and stop here okay so let's go ahead and run it and you'll see that when i run it it says hit line breakpoint line eight and it gives you the output here and now you can go ahead and debug the script from there on so basically just stopped at this point here but let's say you wanted to continue you go back to debug and you can say you can either skip that that line by doing a step over or you can step into it so let's go ahead and step into it and you can see that now it's running this line how do we know it's saying it's downloading which is this invoke web request download path file path and it's run it and now it's waiting for me at line nine so that's pretty helpful if you're trying to debug a script and you can also note down here that it says dbg in this brackets here of course that's letting you know that you're currently in debug mode let's go ahead and continue here toggle the breakpoint and that's how you remove the breakpoint and i'm gonna go ahead and stop the debugger okay because otherwise if you run if you're trying to test the script you'd have to run the whole thing right so this basically just allows you to stop at a certain point and then you can either run that step as well and then step over it so yeah so that's among one of the main features of powershell ise that you should be aware of i think the intention is visual studio code is supposed to replace powershell ise and in many aspects it does but i still find myself using powershell ise quite a bit especially when learning new commandlets and just trying things out it's like my scratch pad and then once i have something that i can then i'm ready to save to versioning then usually i'll switch over to visual studio code it's just a habit of mine i know other people probably just jump in directly to visual studio code i still see the benefits of using powershell ise and i'll continue to use it until it's no longer available but until then um you know i i still recommend people learn it since it comes with built into your windows machine why not right well i hope you enjoyed watching this video thank you for watching bye
Info
Channel: skunklabz
Views: 7,131
Rating: 4.9139786 out of 5
Keywords: SkunkLabz, Episode 13, PowerShell, PowerShell ISE, Scripting, Windows, IDE
Id: pJh2xlDMEcQ
Channel Id: undefined
Length: 21min 46sec (1306 seconds)
Published: Mon Aug 24 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.