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 3 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 80 times
jackdryan
1 year, 10 months ago
A is correct.
upvoted 3 times
...
...
NaoVaz
Highly Voted 2 years, 4 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
...
zhorj1kuee
Most Recent 2 days, 19 hours 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 week, 1 day 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 week, 3 days 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 week, 6 days 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 week, 6 days 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
2 weeks, 5 days 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
1 month 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 2 times
...
testumesh1980
1 month, 1 week ago
Selected Answer: C
Because of coexistence with the on-premises Active Directory domain group, policies can be used
upvoted 1 times
...
shacky100
1 month, 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
2 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
...
leonmc00
2 months ago
Selected Answer: C
As the question specifies "The on-premise virtual environment consists of virtual machines (VMs) running on Windows Server 2012 R2 Hyper-V host servers." the correct answer is C. IF the VMs were running in Azure then the answer would be A
upvoted 1 times
...
shafiqeee
2 months, 1 week ago
Selected Answer: C
should be the C
upvoted 1 times
...
Andre369
3 months, 1 week ago
Selected Answer: C
C. Configure a Group Policy Object (GPO) to run the scripts as startup scripts. By configuring a Group Policy Object (GPO) to run the scripts as startup scripts, you can automate the execution of the PowerShell scripts on the new VMs when they start up. This ensures that the scripts are executed consistently and reliably on each VM during the startup process. Option A, configuring a SetupComplete.cmd batch file in the %windir%\setup\scripts directory, is not the best solution in this scenario as it applies only to the initial installation of Windows and would not cover the configuration of newly created VMs. Option B, configuring the scripts as logon scripts through Group Policy, may not be ideal in this case as logon scripts are executed when a user logs in, whereas the requirement is to run the scripts on the VMs themselves, regardless of user logins. Option D, placing the scripts in a new virtual hard disk (VHD), would require additional configuration steps and might not be necessary or the most efficient solution for executing PowerShell scripts on the new VMs.
upvoted 9 times
etrop
10 months, 1 week ago
Will group policy even work if the systems are not joined to the domain yet?
upvoted 2 times
...
SivaPannier
1 year, 4 months ago
The custom system configuration is a one time activity for every VM. If we keep that in the startup script, the configuration will be executed every time the VM is started and it is not expected. Hence the answer should be A. Also the SetupComplete.cmd will be acting as a wrapper and it can be wired to powershell script.
upvoted 5 times
58b2872
2 weeks, 5 days ago
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
...
...
...
asuarez
3 months, 2 weeks ago
Selected Answer: C
The best solution to ensure that your PowerShell scripts are run on the new VMs is to configure a Group Policy Object (GPO) to run the scripts as startup scripts (Option C). This approach ensures that the scripts are executed when the VM starts up, which is ideal for initial configuration tasks.
upvoted 1 times
sca88
2 months, 1 week ago
In this way the script will be executed on each restart of the VM... The correct answer shold be A
upvoted 1 times
...
...
dirkxi
3 months, 2 weeks ago
The correct answer is C. This is not an Azure-specific question but a general Microsoft enterprise-managed question.
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