Courseiva
hardMultiple ChoiceObjective-mapped

220-1102 Practice Question: A technician is creating a PowerShell script that…

A technician is creating a PowerShell script that must be deployed via Group Policy to all workstations. The script should run in the user context and display a message if the user's password is about to expire within 7 days. The script must not show any PowerShell console window. Which scripting technique should be used?

⚠ Common exam trap

Many candidates assume PowerShell's `-WindowStyle Hidden` or `-NoProfile` eliminates the console window entirely, but they overlook that PowerShell.exe is inherently a console application and will still flash a window, whereas VBScript's `wscript.exe` host runs without any console.

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

Use a VBScript with a pop-up message box

VBScript's `MsgBox` function creates a pop-up message box that runs in the user context without a console window, making it ideal for displaying password-expiry warnings via Group Policy. PowerShell scripts, even with `-WindowStyle Hidden`, briefly flash a console window unless compiled into an executable, which violates the requirement to show no console window. VBScript natively integrates with Windows Script Host (WSH) to produce a GUI pop-up without any console overhead.

Answer analysis

Option-by-option breakdown

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

  • Use the 'Write-Host' cmdlet to display the message

    Why it's wrong here

    Using the 'Write-Host' cmdlet directly outputs text to the PowerShell console window's standard output stream. For this message to be visible to the user, the console window itself must be open and active on the desktop. This directly contradicts the requirement for the PowerShell script's window to remain hidden, as 'Write-Host' is fundamentally tied to the console's display.

  • Use a VBScript with a pop-up message box

    Why this is correct

    A VBScript can effectively display a pop-up message box using the 'MsgBox' function, which creates a graphical dialog independent of any console window. When executed via 'wscript.exe' (Windows Script Host), the VBScript process can be launched with a hidden window style (e.g., using `Start-Process -WindowStyle Hidden` in PowerShell or `WScript.Shell.Run` with a '0' parameter), allowing the message to appear without the script's execution window being visible. This method perfectly satisfies both the hidden window and user notification requirements.

  • Use the '-NoProfile' parameter when starting PowerShell

    Why it's wrong here

    The '-NoProfile' parameter, when used with 'powershell.exe', instructs the PowerShell engine to skip loading any user-specific or system-wide profile scripts (e.g., `Microsoft.PowerShell_profile.ps1`). While useful for ensuring a clean execution environment or troubleshooting, this parameter has no impact on the visibility of the PowerShell console window itself. The console window would still launch and remain visible, failing to meet the requirement for a hidden window.

  • Use a scheduled task with 'Run whether user is logged on or not'

    Why it's wrong here

    Configuring a scheduled task with the 'Run whether user is logged on or not' option causes the task to execute in a non-interactive session, often in an isolated desktop session (Session 0) or as a background process. In such an environment, any attempts by the script to display graphical user interface (GUI) elements, such as a message box, or console output would typically not be visible on the user's active desktop session. Therefore, the user would not receive the intended message.

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.