Learning PowerShell – Homework Four Answers

Share:
PowerShell

PowerShell Homework Four

By: Steven Aiello

Answer the questions as best as possible in your own words. By answering the question in your own words you will learn more than simply repeating what you’ve heard. You are encouraged to visit the source links in the lessons to do more research on the subject.

Remember the point of the homework is not simply to finish, but to learn!

1. What is a pipe in relation to PowerShell and how is it used?

The “|” command is used to break apart logical statements in PowerShell. The pipe also can used to add filtering by using “select” statements.

2. If you wanted to find out all the information that’s available from a command even if it’s not listed by default on the screen what method could you use?

You could always use the Export-Csv command and write the data to a file. PowerShell will only display so much information on the screen because of size limitations. If you need to see more than that writing the data to a file is a great option.

3. If you wanted to save a result of the PowerShell Get-Process command to the file “saveme.csv” in your C drive what command would you use

“Get-Process | Export-CSV c:saveme.csv”

4. What command would you use to select only the display name for your system services in PowerShell

Get-Service | WHERE {$_.Name –eq “PowerShell”}

5. What command would you use to select all information about the process named svchost?

Get-Process | WHERE {$_.Name –eq “svchost”}

6. What does the “$_.” symbol stand for in PowerShell?

$_. is a symbol that references the object that has been passed to it from the left side of the pipe

Share:

Leave a reply

− seven = three

This site uses Akismet to reduce spam. Learn how your comment data is processed.