Module 11 Assessment
What is the example of a block comment found in PowerShell? Powershell does not support block comments. A block comment starts with "<@" and ends with "#>". A block comment starts with "!#" and ends with "#!". A block comment starts with "<#" and ends with "#>".
A block comment starts with "<#" and ends with "#>".
This assigns the date today to the variable $Today1 and converts the current year to a string type. All of the answers are examples of a verb found in the PowerShell cmdlet format. Get Start New
Get
What command should you use to view the execution policy in PowerShell? Get-Policy Get-RestrictedPolicy Show-ExecutionPolicy Get-ExecutionPolicy
Get-ExecutionPolicy
In PowerShell how do you list all processes and sort them by ID? get-process Sort Object -Property ID Get-Process -name | Sort-Object -Property ID Use Task Manager. Get-Process | Sort-Object -Property ID
Get-Process | Sort-Object -Property ID
In PowerShell you type get-execution policy. Your see that Restricted is the policy that is currently applied. What does this mean? No scripts are allowed. This is the default setting, so you will see it the first time you run the command. With this setting in place, before executing, a script will ask you to confirm that you want to run it. You can only run your trusted PowerShell scripts You can only run your own PowerShell scripts
No scripts are allowed. This is the default setting, so you will see it the first time you run the command.
What does AllSigned mean when setting up a PowerShell execution policy? No scripts are allowed. This is the default setting. You can run your own scripts or scripts signed by a trusted developer. You can run scripts signed by a trusted developer. Before executing, a script will ask you to confirm that you want to run it. You can run any script you want.
No scripts are allowed. This is the default setting.
Review the PowerShell script. What does this code do in the script? Today1 =(Get-Date) ToString( "yyyy") This assigns a string variable to the method yyyy. This assigns a string variable to the object (Get-Date). This assigns a string variable to the year (GetType). This assigns the date today to the variable $Today1 and converts the current year to a string type.
This assigns the date today to the variable $Today1 and converts the current year to a string type.
The same commands that you can run from the command-line in Windows will also work in PowerShell. Example: IPCONFIG True True
True?
You use the -Whatif parameter in PowerShell. Which cmdlets should you apply this parameter? Use this perimeter on any of the get-service and get-process commands. Use this perimeter on any PowerShell cmdlets. Use this perimeter on any PowerShell show cmdlets. This only works for cmdlets that change system state. Therefore, there is no -WhatIf parameter for cmdlets like Get-Process that only display information.
Use this perimeter on any of the get-service and get-process commands.
You want to find the process ID of notepad on your Windows 10 workstation. What command should you run in PowerShell? get-process notepad.exe get-application notepad.exe get-process -name notepad.exe get-process -name notepad
get-process -name notepad.exe
In PowerShell how do you send the output of the command get-service to a text file? Write-command Get-Service > myFile.txt get-service | out-file sevice.txt get-service write file service.txt get-service | write-file sevice.txt
get-service | out-file sevice.txt