Courseiva
mediumMultiple ChoiceObjective-mapped

220-1102 Practice Question: A company uses a login script that sets…

A company uses a login script that sets environment variables and maps drives based on the user's department. The script works for most users, but some report that the drive mappings are missing. The script is written in batch and uses 'if' statements to check department codes. What is the most likely cause of the intermittent failures?

⚠ Common exam trap

CompTIA often tests the case sensitivity of batch file string comparisons, knowing that candidates assume string comparisons are case-insensitive by default, leading them to overlook this subtle but critical behavior.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The department codes in the script do not match the actual codes due to case sensitivity

Batch file 'if' statements are case-sensitive by default when comparing strings. If the script checks for department codes like 'SALES' but the actual environment variable or user input contains 'sales' or 'Sales', the comparison fails and the drive mapping block is skipped. This explains why the issue is intermittent — it depends on how the department code is stored or passed.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The script runs too early before the network is fully initialized

    Why it's wrong here

    The script running prematurely before network initialization can indeed cause intermittent drive mapping failures. This occurs when the network stack, DNS resolution, or domain controller authentication services are not fully operational at the exact moment the script attempts to connect to network shares. The timing can vary slightly between logons or system loads, leading to a race condition where sometimes the network resources are available for mapping, and other times they are not, resulting in inconsistent success.

  • The department codes in the script do not match the actual codes due to case sensitivity

    Why this is correct

    Batch script 'IF' comparisons, by default, are case-sensitive. If a login script uses a conditional statement like 'IF "%DEPARTMENT%"=="Sales"' to map a drive, but a user's actual department attribute is stored as "sales" or "SALES" in Active Directory, the condition will evaluate as false. This mismatch prevents the drive mapping for those specific users, explaining why some users experience successful mappings while others, whose department codes differ only in case, do not, leading to intermittent failures across the user base.

  • The script is using 'setx' instead of 'set' for environment variables

    Why it's wrong here

    Using 'SETX' in a login script creates a persistent environment variable that remains active across user sessions and system reboots, unlike 'SET', which creates a temporary variable for the current session only. While 'SETX' might not be the intended command for a session-specific drive mapping script, its use would not cause intermittent drive mapping failures. The persistent variable would either consistently enable or consistently prevent the mapping based on its value, rather than exhibiting sporadic behavior.

  • The user accounts lack permission to run login scripts

    Why it's wrong here

    If user accounts genuinely lacked the necessary permissions to execute login scripts, the problem would manifest as a consistent and complete failure for all affected users every time they logged in. Permissions are typically binary and apply uniformly, meaning the script would either always run or always fail. The scenario describes intermittent drive mapping failures, which points away from a fundamental permission issue and towards a conditional or timing-dependent problem within the script's execution logic.

About these practice questions

This 220-1202 question is part of Courseiva's 495-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 220-1202 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 220-1202 exam.