Your company has an Azure Active Directory (Azure AD) tenant that is configured for…
- User
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).
- Assistant
To ensure that your PowerShell scripts run automatically on newly created Virtual Machines (VMs) in your hybrid Azure Active Directory (Azure AD) and on-premises Active Directory environment, the best solution is:
A. Configure a SetupComplete.cmd batch file in the %windir%\setup\scripts directory.
Explanation:
-
SetupComplete.cmd:
- The
SetupComplete.cmdfile is executed once after the Windows installation completes, specifically after the system setup phase but before the first user logon. - By placing your scripts within this batch file, you ensure that the necessary configurations are applied immediately after the VM is provisioned, without relying on user interaction or domain policies.
- This method is ideal for initial setup tasks, ensuring consistency and automation across multiple VMs.
- The
-
Other Options:
- B. Group Policy Object (GPO) as logon scripts: These scripts run every time a user logs in, which could lead to redundant executions and potential performance issues. They also require user logon, which may not be ideal for system-level configurations.
- C. Group Policy Object (GPO) as startup scripts: While startup scripts run before user logon and are suitable for system-wide configurations, they depend on the VM being part of a domain and the correct GPOs being applied. This introduces dependencies that might complicate the automation process.
- D. Placing scripts in a new Virtual Hard Disk (VHD): Simply placing scripts on a VHD does not guarantee their execution. Additional steps would be required to execute these scripts, making this approach less reliable and more manual.
By using the
SetupComplete.cmdmethod, you ensure that your PowerShell scripts are executed automatically and reliably during the VM setup process, providing a streamlined and efficient approach to automating the configuration of your new VMs.Answer:
A. Configure a SetupComplete.cmd batch file in the %windir%\setup\scripts directory. -