0
0
PowerShellscripting~10 mins

PowerShell console and ISE - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to display the current date and time in PowerShell.

PowerShell
Get-[1]
Drag options to blanks, or click blank then click option'
ADate
BService
CProcess
DEventLog
Attempts:
3 left
💡 Hint
Common Mistakes
Using Get-Process instead of Get-Date
Trying to use Get-Service which lists services
2fill in blank
medium

Complete the code to list all running processes in PowerShell.

PowerShell
Get-[1]
Drag options to blanks, or click blank then click option'
AService
BProcess
CEventLog
DItem
Attempts:
3 left
💡 Hint
Common Mistakes
Using Get-Service which lists services, not processes
Using Get-Item which is for files and folders
3fill in blank
hard

Fix the error in the code to clear the PowerShell console screen.

PowerShell
[1]
Drag options to blanks, or click blank then click option'
AClearScreen
BClear
CClear-Host
DClear-Console
Attempts:
3 left
💡 Hint
Common Mistakes
Using Clear instead of Clear-Host
Trying ClearScreen which is not a cmdlet
4fill in blank
hard

Fill both blanks to create a new PowerShell script file.

PowerShell
New-Item -Path . -Name [1] -ItemType [2]
Drag options to blanks, or click blank then click option'
Ascript.ps1
Bfolder
CFile
Ddirectory
Attempts:
3 left
💡 Hint
Common Mistakes
Using -ItemType folder instead of File
Naming the file without .ps1 extension
5fill in blank
hard

Fill all three blanks to run a script named 'test.ps1' in PowerShell.

PowerShell
powershell.exe [1] [2] [3]
Drag options to blanks, or click blank then click option'
A-File
Btest.ps1
C-NoExit
D-Command
Attempts:
3 left
💡 Hint
Common Mistakes
Using -Command instead of -File
Not specifying the script file name
Not using -NoExit and losing the console window