Bird
0
0

You want to update multiple users' phone numbers stored in a CSV with columns 'SamAccountName' and 'Phone'. Which approach correctly updates the phone numbers?

hard📝 Application Q9 of 15
PowerShell - Active Directory
You want to update multiple users' phone numbers stored in a CSV with columns 'SamAccountName' and 'Phone'. Which approach correctly updates the phone numbers?
AImport-Csv phones.csv | ForEach-Object { Set-ADUser -Identity $_.SamAccountName -OfficePhone $_.Phone }
BImport-Csv phones.csv | ForEach-Object { New-ADUser -SamAccountName $_.SamAccountName -OfficePhone $_.Phone }
CImport-Csv phones.csv | ForEach-Object { Set-ADUser -SamAccountName $_.SamAccountName -PhoneNumber $_.Phone }
DImport-Csv phones.csv | ForEach-Object { Get-ADUser -Identity $_.SamAccountName | Set-ADUser -OfficePhone $_.Phone }
Step-by-Step Solution
Solution:
  1. Step 1: Use Set-ADUser to update existing users

    Set-ADUser with -Identity and -OfficePhone updates phone numbers correctly.
  2. Step 2: Exclude incorrect cmdlets and parameters

    New-ADUser creates users, so B is wrong; A uses invalid parameter PhoneNumber; D unnecessarily uses Get-ADUser.
  3. Final Answer:

    Import-Csv with Set-ADUser and -OfficePhone -> Option A
  4. Quick Check:

    Update phone with Set-ADUser -OfficePhone [OK]
Quick Trick: Use Set-ADUser -OfficePhone to update phone numbers [OK]
Common Mistakes:
  • Using New-ADUser to update users
  • Wrong parameter name PhoneNumber
  • Unnecessary Get-ADUser call

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes