代写 shell Homework Week 1

Homework Week 1
Instructions:
• Open a PowerShell console
• Type in the command for each exercise. Use the Hint if you don’t know the answer.
• Copy and paste your answers into this document.
• Submit this document on MySeneca under the submission link in week 1 for grading

Exercise 1
Find all commands that have the word “date” in them. ).5 marks)
Answer:

Hint : Use wildcards and perform the most general search of all commands

Exercise 2:
Find all commands that have the word “log” in the noun. (0.5 marks)
Answer:

Hint: Use wildcards and perform the most general search of all commands.

Exercise 3:
What command will show all available help information on the get-date command?
Answer:

Hint: Use the parameter which gets all help information

Exercise 4:
What command will show only the syntax of get-service cmdlet?
Answer:

Hint: Do not use get-help

Exercise 5:
What command will display only help examples of the “Write-Host cmdlet?
Answer:

Hint: Use get-help get-help -parameter * to find the answer

Exercise 6:
What command will display the detailed help information of the Read-Host command?
Answer:

Hint: Use get-help get-help -parameter * to find the answer

Exercise 7:
What command will show all of the properties and methods of the object New-TimeSpan?
Answer:

Hint: Use the direct method and pipe it to the cmdlet designed to show properties and methods

Exercise 8:
What command will show only the methods of a New-TimeSpan object? Use the alternate method
Answer:

Hint: Use Get-Help and search the parameters of Get-Member. The alternate method stores the object in a variable first.

Exercise 9:
What command will show only “running” services on the local computer?
Answer:

Hint: Use the Where-Object and filter on the property Status

Exercise 10:
What command will sort the Exercise 9 command in descending order and output to a file called services.txt?
Answer:

Hint: Use a cmdlet which will create a file.

Exercise 11:
What command will display all of the services on the local computer that have “Windows” in their display name and send the output to a file called services.txt? (append it to the file in Exercise 10)
Answer:

Hint: Use the comparative operator -like which is used to compare strings. Use wildcards to help in the search and remember service objects have several names. Search Get-Help for the parameters of Out-file to find the one that appends content to an existing file
Exercise 12:
What command will display all of the parameters of the get-date cmdlet?
Answer:

Hint: Use get-help and search for the parameter that displays all parameters of a command

Exercise 13:
What command will display all commands which have a parameter of “Restart”?
Answer:

Hint: Do not use Get-Help. Search the parameters of the Get-Command cmdlet

Exercise 14:
What command will display the contextual help on automatic variables?
Answer:

Hint: Use get-help and search the about_* pages.

Exercise 15:
What command will display all commands that end with the word “EventLog”?
Answer:

Hint: Remember that cmdlets have a verb-noun syntax

Exercise 16:
What type of variable is $_ and when is it used?
Answer:

Hint: Use get-help about_automatic_variables