 Hello everybody, my name is John Hammond and in this video I want to do something new but not entirely new kind of wanted to go back to the channel's roots where I do a longer video Series on one specific kind of technology or programming language And it's a tutorial series and learning thing rather than just a capture the flag video right up like I've kind of doing lately So this video I want to kick start the Windows PowerShell video series tutorial. I'm really excited about it But before we get started. I want to talk to you guys about CircleCI So you probably heard the terms continuous integration Continuous delivery and continuous deployment and that is what CircleCI is all about CircleCI offers an awesome platform that lets you automate your development of any software code and projects that you're working on in a Managed safe and test environment. They're working with some big players They have Facebook Spotify GoPro listed here And I'm sure there are plenty others and they offer a free trial version If you're interested in it, you can check out the cloud implementation or the server implementation And they are all about helping you develop the next best thing One thing that I especially wanted to mention was that they offer support for Windows They have incredible documentation and they offer some fantastic stuff Everything that they test within the CI pipeline is working on a virtual machine So it guarantees you have isolation of what you're working with it's using server core of Windows Server 2019 the latest stuff and they're using PowerShell That's a default shell, but you can obviously customize that to bash and old-school CMD.exe Offers a little bit of integration with Docker and it's just awesome The syntax is in a super simple YAML configuration file And it could not be easier to test and develop your software within a CI CD pipeline If that all sounds awesome to you, and I know it does Please go check them out on their website CircleCI.com Take a look through that documentation and see how easy it is to set up this pipeline And give them a shout, let them know that John Hammond sent you They're going to make your development process so much easier Okay, so let's dive into some PowerShell I'm working in a flat vanilla Windows 10 image I just updated it to the 1903 update And I need to put forth my usual disclaimer that I do at most of my videos In that I am not by any means a professional I'm not a Microsoft MVP by any stretch of the imagination So if I ever misspeak or if I ever relay some information to you that is wrong And some of you guys are veterans and rock stars And totally know, whoa John, you messed up on that Let me know, please say the word Constructive criticism in the comments We're all here to learn and that's what I'm all about So please do just let me know Hey John, you're being an idiot But let's get started This is going to be an introductory video It's meant to be an introduction video So it's going to be some light lifting What I first want to cover is just for one thing Opening up PowerShell So I hit the start button Or just the Windows key in my keyboard I'm kind of a keyboard guy I like to be on the command line So I would just type in PowerShell In that search bar there And you'll see it pops up Okay, Windows PowerShell is the app we can work through There are a couple others listed though You have Windows PowerShell ISE Which is there I don't know that acronym Integrated Something Environment Software Engineering It's a... Tech-setter is not the right word But it's an IDE Normally that integrated development environment For creating PowerShell code and PowerShell scripts We're going to get into a lot more PowerShell scripts Later on in the series For now, just baby stuff Trying to get our feet wet You also see Windows PowerShell With that parentheses x86 So what is that? That's that 32-bit rendition of Windows PowerShell Doesn't really matter which one we start The 64-bit one is just normally what we'll be working with Just that we're running a 64-bit PC Very, very likely And of course they have that 32-bit version of ISE You can just click on that Or hit Enter to go ahead and start it up To note, sometimes When we're going to be doing some things Later on in the series, hopefully We'll be working with commands That will need administrative privileges So if you ever want to open up PowerShell With administrative privileges You can obviously just right click on that And hit Run as Administrator What I like to do personally Is just CMD or PowerShell That's what this video series is on And I just hit Control-Shift-Enter on my keyboard And that will go ahead and ask me With Administrator privileges, do you want to run this? So here we go Windows PowerShell starts up And we are ready to rock With the Administrator PowerShell Note that it puts us in Windows System32 As our path If I were to open that up in simply my user account It puts me in Once it gets there, see Users-John So that's my user profile Or kind of my home directory equivalent in the Linux world And that's the prompt, right? That's just what's going to tell us That we are in a directory If you ever want to change directory You can move with that CD command We've seen in every other system shell Between Bash or CMD.exe, et cetera, et cetera You can CD to Period Which is that symbol for the current directory So see, our path had not changed If I were to CD Period, Period That'll move us up a directory That means our parent directory So now we're in see Users If I were to run a command like DIR What you would normally expect in the CMD.exe world You'll note that, okay, here's a directory listing Of the current directory that we're in So I can see John is an option there That's that folder I was just in And we can CD all the way to that And using that as a relative path That means from the directory I'm currently in We can move to the directory that is next to us Or in the same folder entry that we're in I slide into John and that works just fine for us And that was a relative path If I wanted to use an absolute path Or going from the very, very root of the file system Or any drive that I'm working with You could specify all of the path's subsequent So I'd say CD, C, colon, backslash, Users And I'll just go straight there And that's the absolute path Rather than going up with the two periods Using a relative path So that's that easy simple navigation Around the PowerShell command line You guys know the CD command But you'll notice that I ran the DIR command And some of you PowerShell purists Might already be angry at me Because the DIR command in PowerShell Is not so much a command And me even saying the words command When I'm discussing PowerShell Is already inherently wrong So PowerShell refers to everything That you end up typing at the prompt As a command let So if I were to say something wrong Like please subscribe Cool, yeah PowerShell will try and track that down But suddenly it'll get angry at me It'll get that black background and red text My screen gets bloody PowerShell yells at me That says, please subscribe is not recognized As the name of a command let And that's what PowerShell refers to Everything that it's going to be working with as Nor is it a function or a script file Or operable program Check the name Maybe you had just a stupid command You mistyped something Obviously that's not something we can run Please subscribe is not unfortunately Unfortunately it's not something we can just type Into PowerShell and know to do things automatically It's not a command let And that's what PowerShell wants to get across Is that everything that you type in that prompt Should be a command let And command let in PowerShell Normally have the syntax verb hyphen noun Normally there are two words or three words It depends on the lengths get the commands Let's command let's get more and more complicated Or you're doing more advanced stuff Maybe there's more to what that syntax And looks like But generally you can base The look of a command let base off of that Verb noun structure Verb hyphen noun And they like to use the kind of camel case structure However PowerShell is case insensitive It does not matter if you type in A command let with random capitalization Or that expected kind of camel case notation there So I'm using control L by the way to clear my screen CLS works just as fine just as well Clear might also do it Yep And the reason that CLS and clear work the same way And the same way that DIR works just as easily LS also works if you are kind of more of a Unix or Linux guy But those aren't the command let that I was just talking about The command let that we're looking at Or what we're actually running when we run DIR or LS Is actually get hyphen child item And that'll list out the children of the current directory But commands like DIR or the syntax here like DIR and LS Those are actually aliases for that get child item commandlet So if you want to see wow, okay It's an alias right, it's a nickname It's a convenient shorthand thing If you're more used to being a Linux guy working with bash And you just type in LS or RM or MOV And those commands are different from the usual CMD.exe, copy or MOV or DEL stuff like that If you want to see those aliases You can type in the command let get alias And that lists out a bunch of stuff, right We could go through this, we could take a look And there is a lot of information that's returned to us You see all of these kind of nicknames for commands CLS is in there just as we saw Cat might be used to that in the Linux world CP, copy, just as I was talking about And those all refer to copy item As the real commandlet that you're running there But those are just aliases that you're running Now notice that the output of these commandlets Is kind of in a interesting format Where they are kind of formatted like a table Where they're given kind of a header here With a piece of information that might vary For each thing that's returned to us The same thing that we saw when we ran DIR or LS Again, I should be running the full get child item commandlet That's more PowerShell pure I am kind of inherently a Linux guy though As you've seen probably see from other videos So if I end up typing those LS or Cat and said Please don't get angry at me I know I should be using the PowerShell side But that habit will grow Hopefully the same way yours will As we do more of this So I was just talking about though These kind of headers or the information title For each of the entries that's returned from us Or returned to us when we run a commandlet So what are those things? Well, this is where I wanted to talk about Kind of the fundamental shift and what happens When you're using PowerShell versus Bash Or CMD.exe or CShell or KShell or any other Any other system shell that you're probably used to PowerShell works with the input and output That's like coming out on the screen Not in the normal text based stream orientation You know on Linux you have standard output Standard input and you can pipe and redirect those As you would normally in CMD.exe PowerShell turns that on its head We're no longer working with just plain text But we're working with objects We're working with C sharp and dot net framework Kind of the back end of Windows objects Each of these is returned to us as some specific thing So when they go down the pipeline Or when we're working in PowerShell And we're passing objects from one command to another As you would normally in a pipe in Linux or in Bash You're piping objects into each other So let's try that Let's see if we were to run get child item Here are our things Here are the current directories and the users folder And let's say I were to pipe that And pipe is that vertical bar It's kind of above your enter key The shift rendition of the backslash key And we can pipe it to something else We can pipe it to, let's say, select And select object I think is the actual full title name So select object doesn't look like it did anything To our output, it didn't really specify anything at all That's because select object needs another argument Or some other representation of what to do with the data Or some configuration tweak as to how that program Or command line is going to operate So the way that we can do that is by supplying an argument An argument is meant to be the information and data That follows a command or command line The command line is the very, very first thing You type in here Get child item or select object Because we're piping them They look like they're kind of put together But they are, in fact, different commandlets Or commands The arguments or the parameters And I'll say those words often interchangeably Are the things that you supply after They are separated and tokenized by a different space That separates them apart So let's say I wanted to select the object name And that will return just John or public Because that is the name of what I'm actually receiving here Now that's something that we supplied to select object name As if that's what we're focusing on That's what we want to filter and zoom in on But we can actually supply more information To select object I'll clear the screen here Let's say we wanted to select hyphen first one Now that makes sense, right? I'm selecting the first object And I'm able to do that because of that hyphen first And that's a parameter and argument That I'm supplying a new value for First one And once I hit enter, now all I see is John Public isn't there anymore You could do that very, very same thing with last Or you could index And when you index, it's zero based So index zero actually refers to the very first entry John in this case And if we wanted to zoom in on that We can keep piping more and more To grab a specific property out that we wanted to We can select object name and just get John returned to us Note here that PowerShell is still gonna give us That kind of header Oh, sorry Ubuntu, my virtual machine is kind of Getting in the way there So we can drill down and figure out More and more properties or information Regarding that object If you wanted to get more regarding that You could actually check out get member Pipe it what you're working with Pipe the object that you're working with into get member And you can see more information As to what that object actually entails Talks about properties, which are like variables For that object Or methods, which are like functions That that object can perform Like deletes If we wanted to end up deleting that Okay, that's getting really annoying Sorry You could get files If you wanna see, okay Those are new files in there or move things to them Or just convert that to a string, et cetera, et cetera And you can see, okay These are the arguments that that method Or property might expect Or what kind of type that property or variable is Is it a Boolean value? Is it a string? Is it just text or stuff like that PowerShell is really, really awesome though Giving you kinds of types Or structures for information Like if you wanna have an IP address There's a PowerShell property In a format for an IP address You don't have to try and colluge that together With your own regular expressions, validation PowerShell will do that all for you And we'll play with that in the future For now, I just wanted to get these ideas across And that you can explore an object more and more And get more information out of it That you wouldn't have seen before So we didn't see a root or parent displayed In that regular output When we just simply wanted to grab The first item here Grab first one You don't see root or parent in there But if we wanted to select that Select object parent Then it will return it to us Note that select is the alias Or shorthand notion for select object So you can just use that If it's a little bit easier to type or quicker for you But when we're returning that information We're returning that in a very PowerShell-like way There's a different way to do that If you kind of just got the object That you wanna work with here Let's say we got just this directory Because we're selecting the first one In our current directory listing What we can do is actually encapsulate that In parentheses here An opening parentheses at the very start And a closing parentheses at the very end That will just say Now I'm gonna make this object As something that I can work with So we can run those methods Or access those properties And kind of a more programming-like way That you're used to Maybe more like a C-sharp style or syntax Rather than the PowerShell pipeline We could if we wanted to Write .name And we'll retrieve just that property Just that string here Remember if we were using that with select name It gives us that PowerShell header Maybe that's not the output that you want If you're trying to avoid that One option, one way you could go about that Is just using that kind of C-sharp style By wrapping the object that you're working with In parentheses and then using a .selector To work with things Or you could do methods, right? You could try and run some of those things That we saw in GetMember GetMember is fantastic GetMember is awesome Because it'll let you explore and track down Some of the properties or variables Or values or information that you're really looking for I think a lot of using PowerShell Is a very exploratory action Because you're just kind of discovering Where in this web of windows stuff Can I find the information I'm actually looking for That might be how you play And get to know PowerShell a little bit more So that is what I can think of For everything that I want to talk to you about And show you in this video We talked about what aliases are We talked about what a command Or a commandlet and arguments and parameters are And we took a look at what The GetMember commandlet would do for us Let's just explore an object But before I go, actually I thought of it now I want to show you how we can get help Or learn a little bit more about a specific commandlet If I were to run GetHelp on select object That'll give us some more information As to what we can do with this It's like the man page for PowerShell Right, the manual This is what we're actually working with Here's the commandlet there And it shows you some arguments and parameters You could pass through it Just as I talked about last Or first or others here And we'll explore these more in depth But for now I just want to show you Basically what GetHelp can do for you Because it'll give you even examples If you wanted to get more information This is a shot in the dark here But let's run GetHelp on GetHelp Okay, yep Cool, it will tell us how we can GetHelp You could actually ask for more information By using stuff like hyphen full Let's say, let's get the full help On that select object commandlet It tells us what it outputs What it inputs It even shows us more information On what all of these parameters do And it could give us some examples in some cases If you don't know the name of the commandlet That you're looking for Or what you particularly want to be investigating Or how you want to work with stuff You can try and GetHelp On things like printer And you can separate these by stars Or the asterisks Because it'll act like a wild card Anything surrounding the word printer on either end Or if we were to add one Only a star or asterisk at the very, very end It says everything that starts with the word printer Let's try with the asterisks around there That will showcase These are all the commandlets that you could use Maybe you wanted to run set printer Or get printer Or rename or add printer, etc Or you could do that with stuff like networking Right? GetHelpOnNetwork And then you can grab more information By finding those different commandlets Also PowerShell has a GetCommand commandlet That will show you everything that you could potentially do Within PowerShell And if you wanted to search or filter through that You absolutely could If you wanted to say GetCommand on printer With those asterisks and stars around it To track stuff down So that's how you could navigate Or explore or poke around in PowerShell We'll do more of that in the coming videos But I wanted to get this introductory stuff out first I wanted to get lay the foundation And kind of start tilling the ground for What we'll be doing in the later videos So thank you guys for watching I really, really hope you enjoyed this I'm super excited about the series I hope it'll be a lot of fun I hope it'll be much higher quality Than anything I've done before So please let me know Leave a like, comment on the video Hit that subscribe button, the bell thing I don't even know what it does It doesn't do anything Join the Discord server There's a lot of incredible people there Shout out to all of you guys I cannot thank you enough For all the support that you gave me And I'll see you in the next video