Challenge - 5 Problems
PowerShell macOS Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this PowerShell command on macOS?
Consider this command run in PowerShell on macOS:
What does this command output?
Get-ChildItem -Path ~ -File | Where-Object { $_.Length -gt 1000 } | Select-Object -First 1 -Property Name, LengthWhat does this command output?
PowerShell
Get-ChildItem -Path ~ -File | Where-Object { $_.Length -gt 1000 } | Select-Object -First 1 -Property Name, LengthAttempts:
2 left
💡 Hint
Think about filtering files by size and selecting only the first match.
✗ Incorrect
The command lists files in the home directory, filters those larger than 1000 bytes, then selects the first one showing its name and size.
📝 Syntax
intermediate1:30remaining
Which PowerShell syntax correctly sets an environment variable on macOS?
You want to set an environment variable named MY_VAR with value 'hello' in PowerShell on macOS. Which option is correct?
Attempts:
2 left
💡 Hint
PowerShell uses a special variable prefix for environment variables.
✗ Incorrect
In PowerShell, environment variables are accessed and set using the $env: prefix.
🔧 Debug
advanced2:00remaining
Why does this PowerShell script fail on macOS?
This script is intended to list all running processes and filter those using more than 100 MB of memory:
Why does it fail?
Get-Process | Where-Object { $_.WorkingSet -gt 100MB }Why does it fail?
PowerShell
Get-Process | Where-Object { $_.WorkingSet -gt 100MB }Attempts:
2 left
💡 Hint
Check how PowerShell handles numeric values with units.
✗ Incorrect
PowerShell does not parse '100MB' as a number; it must be expressed as an integer number of bytes.
🚀 Application
advanced2:30remaining
How to schedule a PowerShell script to run daily on macOS?
You want to run a PowerShell script located at /Users/username/scripts/backup.ps1 every day at 2 AM on macOS. Which approach is correct?
Attempts:
2 left
💡 Hint
macOS uses launchd for scheduled tasks, not cron by default.
✗ Incorrect
macOS uses launchd and plist files to schedule tasks; cron is deprecated but still works, however launchd is preferred.
🧠 Conceptual
expert3:00remaining
What is the main difference when running PowerShell scripts on macOS compared to Windows?
Choose the best explanation for a key difference when running PowerShell scripts on macOS versus Windows.
Attempts:
2 left
💡 Hint
Think about platform-specific features and cmdlets.
✗ Incorrect
PowerShell Core on macOS runs on .NET Core and lacks Windows-only cmdlets and APIs, so some scripts need adjustment.