Microsoft Azure Administrator — Question 38

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?

Answer options

Correct answer: A

Explanation

The correct answer is A because placing a SetupComplete.cmd batch file in the specified directory ensures that the scripts are executed during the Windows setup process when the VM is being created. Options B and C rely on user logins or system startups, which may not guarantee execution right after VM creation. Option D does not provide a mechanism to run the scripts automatically.