exam questions

Exam AZ-104 All Questions

View all questions & answers for the AZ-104 exam

Exam AZ-104 topic 1 question 21 discussion

Actual exam question from Microsoft's AZ-104
Question #: 21
Topic #: 1
[All AZ-104 Questions]

Your company has an Azure Active Directory (Azure AD) tenant that is configured for hybrid coexistence with the on-premises Active Directory domain.
The on-premise virtual environment consists of virtual machines (VMs) running on Windows Server 2012 R2 Hyper-V host servers.
You have created some PowerShell scripts to automate the configuration of newly created VMs. You plan to create several new VMs.
You need a solution that ensures the scripts are run on the new VMs.
Which of the following is the best solution?

  • A. Configure a SetupComplete.cmd batch file in the %windir%\setup\scripts directory.
  • B. Configure a Group Policy Object (GPO) to run the scripts as logon scripts.
  • C. Configure a Group Policy Object (GPO) to run the scripts as startup scripts.
  • D. Place the scripts in a new virtual hard disk (VHD).
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
j5y
Highly Voted 4 months, 3 weeks ago
Ans: A After Windows is installed but before the logon screen appears, Windows Setup searches for the SetupComplete.cmd file in the %WINDIR%\Setup\Scripts\ directory
upvoted 81 times
jackdryan
1 year, 11 months ago
A is correct.
upvoted 4 times
...
...
NaoVaz
Highly Voted 2 years, 5 months ago
Selected Answer: A
GPOs aren't a thing in Azure AD. Just putting a Script inside the VHD doesn't make it run on boot. Configuring a "SetupComplete.cmd" in the "%windir%\setup\scripts" directory is the correct approach:
upvoted 20 times
...
victorio_27
Most Recent 1 day, 22 hours ago
Selected Answer: C
Para asegurarse de que los scripts de PowerShell se ejecuten automáticamente en las nuevas VM y configuren el sistema correctamente, la mejor opción es usar un GPO configurado para ejecutar los scripts como scripts de inicio. ✅ Opción correcta: C. Configure un objeto de política de grupo (GPO) para ejecutar los scripts como scripts de inicio.
upvoted 1 times
...
chandiochan
2 days, 7 hours ago
Selected Answer: C
The SetupComplete.cmd mechanism is executed during Windows Setup after installation completes. This is useful for initial image configuration but is less flexible if you plan to use an already prepared image or if the VMs are deployed in various scenarios over time. Since your environment is domain-joined (as indicated by the hybrid coexistence with on-premises Active Directory) and you’re creating multiple new VMs, using a GPO with startup scripts is a centralized and scalable way to ensure your configuration scripts run automatically on each new VM.
upvoted 1 times
...
lioroz
4 days, 9 hours ago
Selected Answer: C
The best solution in this scenario is to configure a Group Policy Object (GPO) to run the scripts as startup scripts. This ensures that the PowerShell scripts are executed when the virtual machines start up, automating the configuration process. So the correct answer is C. Configure a Group Policy Object (GPO) to run the scripts as startup scripts.
upvoted 1 times
...
Cruzito
6 days, 5 hours ago
Selected Answer: C
he best solution is C. Configure a Group Policy Object (GPO) to run the scripts as startup scripts. Configuring a GPO to run the scripts as startup scripts ensures that the scripts are executed when the VMs start up, which is ideal for automating the configuration of newly created VMs. This method is reliable and integrates well with the existing Active Directory environment. Option A, configuring a SetupComplete.cmd batch file in the %windir%\setup\scripts directory, is a valid method for running scripts during the setup process of Windows. However, it is typically used for tasks that need to be executed once during the final stages of the Windows setup process, rather than for ongoing configuration tasks.
upvoted 1 times
...
jeff1988
1 week, 6 days ago
Selected Answer: C
C. Configure a Group Policy Object (GPO) to run the scripts as startup scripts. Here’s why: Startup scripts run when the computer starts, before any user logs on. This ensures that the scripts are executed as soon as the VM is powered on and before any user interaction. Logon scripts (option B) run when a user logs on, which means the scripts would only execute after a user logs in, potentially delaying the configuration. SetupComplete.cmd (option A) is used during the Windows setup process, but it is not as flexible or manageable as GPOs for ongoing VM management. Placing scripts in a new VHD (option D) is not a standard method for ensuring scripts run automatically on new VMs.
upvoted 1 times
...
zhorj1kuee
1 month ago
Selected Answer: A
Rationale: The SetupComplete.cmd file is executed immediately after the operating system setup is complete, ensuring that the scripts are run on the new virtual machines as part of their initial configuration. This solution is both direct and efficient for automating the configuration of freshly created VMs. Why not the others? B: Logon scripts via GPO: These run only when a user logs in. For automating initial configurations on new VMs, this is neither timely nor appropriate. C: Startup scripts via GPO: While they run during the computer's startup, GPOs require the machine to already be part of the Active Directory domain, which is not guaranteed for new VMs during initial setup. D: Scripts in a new VHD: While theoretically possible, this approach is cumbersome and lacks the streamlined execution of the SetupComplete.cmd method.
upvoted 1 times
...
Bhushan90
1 month, 1 week ago
Selected Answer: C
Given the options, the best solution to ensure your PowerShell scripts run on the newly created VMs is: C. Configure a Group Policy Object (GPO) to run the scripts as startup scripts. Here's why: Startup Scripts: Configuring the scripts as startup scripts ensures they run when the VM boots up, before any user logs in. This is ideal for initial configuration tasks that need to be completed before the VM is fully operational. Group Policy: Using GPOs allows you to centrally manage and enforce the execution of these scripts across all new VMs in your domain, ensuring consistency and reducing manual effort.
upvoted 1 times
...
premanshum
1 month, 1 week ago
Selected Answer: A
If any script is running in the startup, it slows down the booting time. Startup script should contain only those tems which cannot stay in static state.
upvoted 1 times
...
SolimanAlali
1 month, 2 weeks ago
Selected Answer: C
Configure a SetupComplete.cmd batch file in the %windir%\setup\scripts directory is another valid solution, but it is typically used for very specific scenarios during the initial setup phase of Windows deployment.
upvoted 1 times
...
SolimanAlali
1 month, 2 weeks ago
Selected Answer: C
This is the best approach: Start-up scripts are run when the computer starts, before any user logs on. This ensures that the scripts are run on the newly created VM as soon as it boots, making it ideal for VM configuration automation. You can configure a GPO to run these scripts on all the VMs in your environment.
upvoted 1 times
...
58b2872
1 month, 2 weeks ago
Selected Answer: C
The SetupComplete.cmd batch file in the %windir%\setup\scripts directory can be used only for Windows. It does not work for other operating systems like Linux.
upvoted 1 times
...
SHAHIN_STA
2 months ago
Selected Answer: C
**Correct Answer: C. Configure a Group Policy Object (GPO) to run the scripts as startup scripts.** ### **Why This Is Correct:** - **Startup scripts** run **before user login**, making them ideal for system-level configurations. - Using a **GPO** ensures automatic execution across multiple VMs without manual intervention. ### **Why Others Are Incorrect:** - **A. SetupComplete.cmd:** Runs only **once** after Windows installation, not suitable for recurring tasks. - **B. Logon Scripts:** Run **after user login**, not suitable for system-level tasks. - **D. VHD:** Only stores scripts; does not **automatically execute** them. **Conclusion:** **Option C** ensures **automatic execution** on every VM startup, making it the best choice.
upvoted 3 times
superrvirgo
3 weeks, 4 days ago
The requirement in this exercise is to configure a newly created VMs through a PS script. This suggests that the script is to be run once. Hence, no requirement for reoccurring execution. Also, the SetupComplete.cmd is run first in order and before the scripts deployed by GPOs. And btw, what if the VMs are not to be joined to a domain? The exercise description doesn't say anything about the VMs being joined to a domain.
upvoted 1 times
superrvirgo
3 weeks, 3 days ago
Errata, they of course might be joined to AD, hence please ignore my last sentence
upvoted 1 times
...
...
...
testumesh1980
2 months, 2 weeks ago
Selected Answer: C
Because of coexistence with the on-premises Active Directory domain group, policies can be used
upvoted 1 times
...
shacky100
2 months, 3 weeks ago
ans: C https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/dn789196(v=ws.11)
upvoted 1 times
...
moniker
3 months ago
Selected Answer: C
the best solution is to configure a Group Policy Object (GPO) to run the scripts as startup scripts (Option C). This ensures that the PowerShell scripts are executed when the VMs start up, which is ideal for automating the configuration of newly created VMs in a consistent manner
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago