Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to display the current date and time in PowerShell.
PowerShell
Get-[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Get-Process instead of Get-Date
Trying to use Get-Service which lists services
✗ Incorrect
The Get-Date cmdlet shows the current date and time in PowerShell.
2fill in blank
mediumComplete the code to list all running processes in PowerShell.
PowerShell
Get-[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Get-Service which lists services, not processes
Using Get-Item which is for files and folders
✗ Incorrect
Get-Process lists all running processes.
3fill in blank
hardFix the error in the code to clear the PowerShell console screen.
PowerShell
[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Clear instead of Clear-Host
Trying ClearScreen which is not a cmdlet
✗ Incorrect
Clear-Host is the correct cmdlet to clear the console screen in PowerShell.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using -ItemType folder instead of File
Naming the file without .ps1 extension
✗ Incorrect
New-Item with -ItemType File creates a new file. Naming it with .ps1 makes it a PowerShell script.
5fill in blank
hardFill 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'
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
✗ Incorrect
Use -File to specify the script file, the script name, and -NoExit to keep the console open after running.