Bird
0
0

How do you correctly import users from 'users.csv' and output their email addresses using PowerShell?

easy📝 Syntax Q3 of 15
PowerShell - Active Directory
How do you correctly import users from 'users.csv' and output their email addresses using PowerShell?
AImport-Csv users.csv | ForEach-Object { $_.Email }
BGet-Content users.csv | ForEach-Object { $_.Email }
CImport-Csv users.csv | Select-Object Name
DImport-Csv users.csv | ForEach-Object { Write-Host $_.Name }
Step-by-Step Solution
Solution:
  1. Step 1: Import CSV correctly

    Use Import-Csv to convert CSV rows into objects.
  2. Step 2: Access the Email property

    ForEach-Object processes each object; $_.Email accesses the email field.
  3. Step 3: Output emails

    Simply outputting $_.Email prints the email addresses.
  4. Final Answer:

    Import-Csv users.csv | ForEach-Object { $_.Email } -> Option A
  5. Quick Check:

    Correctly outputs emails from CSV [OK]
Quick Trick: Use Import-Csv and access properties with $_ [OK]
Common Mistakes:
  • Using Get-Content which reads raw text
  • Selecting wrong property like Name instead of Email
  • Using Write-Host unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes