From the course: Learning PowerShell for Windows Server Administration

Unlock the full course today

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

Solution: Create a PowerShell script

Solution: Create a PowerShell script

From the course: Learning PowerShell for Windows Server Administration

Start my 1-month free trial

Solution: Create a PowerShell script

- [Instructor] Now let's take a look at one way to solve this challenge. I gave a starting point where I set the challenge so let's start there. The first line can be done by using the cmdlet, Write-Host, followed by the text in quotes, Current User, colon, and a call to the environment variable, specifically the USERNAME property of that variable. The second line follows this same pattern. The goal is to display the computer name, which is another piece of information in the environment variable. So, Write-Host, quote, Computer Name, colon, unquote, and the environment variable COMPUTERNAME, should do the trick. It is not important to capitalize USERNAME and COMPUTERNAME. That happens by default when you take the help from ISE. But if you're typing it out, it's not case-sensitive, so it's not that important. There is another environment variable named OS, but it only returns the value Windows NT. If we want to see the actual operating system, we're going to need to use something a…

Contents