From the course: PowerShell 7 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Utilize variables

Utilize variables - PowerShell Tutorial

From the course: PowerShell 7 Essential Training

Start my 1-month free trial

Utilize variables

- [Instructor] In order for us to be able to build PowerShell functions and commands, we first need to understand kind of syntax. Now we've done some examples so far of how things go together. So let's just recap a couple of them. The first one is the creation of variables. All variables are created using the dollar command before the name of the variable. And then there's an equal sign that then represents what that value might be. So I'm going to call this one text value one, which means that my variable now has that static value. Now to render that value out, we can simply type var1 and you'll see we'll output the value. We can also type write-host $var1 and it will render that value also. Now, variables can also be dynamically populated, so I can say Get-computerInfo for example. Now you notice the difference between the two. We have the variable with the equals, and then we have a function that populates that.…

Contents