AZ-104 Exam QuestionsBrowse all questions from this exam

AZ-104 Exam - Question 21


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?

Show Answer
Correct Answer: AC

To ensure that the PowerShell scripts are run on new VMs, the best solution is to configure a Group Policy Object (GPO) to run the scripts as startup scripts. This method runs the scripts during the system startup, which is suitable for automating configuration tasks regardless of user logins. Unlike logon scripts, startup scripts do not require an interactive user session, making them more appropriate for tasks that need to be performed on every machine startup. This approach provides better manageability and scalability for ongoing operations and simplifies the deployment of configuration scripts across multiple VMs.

Discussion

17 comments
Sign in to comment
NZure
Oct 2, 2021

Is this really on the AZ-104? It has nothing to do with Azure.

Chi1987
Oct 10, 2021

Dude you might get a question about how you prepare omelette using VMs and LB and still you have to answer it if u want to be MS expert

Takloy
Nov 13, 2021

I need the ARM Template for that!

juniorccs
Jan 15, 2022

damn right

Mozbius_
Jan 18, 2022

That was funny! I had the exact same thought as NZure.

zr79
Feb 22, 2022

When I look more into azure, they just promote their windows products. I see lots of questions on Azure AD.

yashsj
Sep 17, 2023

The question has setup a context stating use of hybrid use of Azure AD with OnPrem Active Directory Domain Controller. So option C seems to be correct option as it uses the information/context provided in the question. Option A might be correct option (although that can also be debated) has noting to do with Azure.

j5yOption: A
Jul 8, 2021

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 https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-a-custom-script-to-windows-setup

jackdryan
Feb 19, 2023

A is correct.

ntinakosOption: A
Sep 24, 2023

A is correct https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-a-custom-script-to-windows-setup?view=windows-11

RavikrsoniOption: C
Oct 17, 2023

C. Configure a Group Policy Object (GPO) to run the scripts as startup scripts. Here's why: Logon scripts: Logon scripts are executed when a user logs on. If the automation tasks should be performed in the context of a user, logon scripts might be appropriate. However, they require a user to log in, which might not be the case for certain automated tasks. Startup scripts: Startup scripts run during the system startup, before the user logs in. This makes them suitable for tasks that need to run regardless of user logins. For automated configuration tasks on VMs, especially when there might not be an interactive user session, using startup scripts through Group Policy is often the preferred method.

Iron_Man_111Option: A
Mar 30, 2024

Run a script after setup is complete (SetupComplete.cmd) Order of operations 1. After Windows is installed but before the logon screen appears, Windows Setup searches for the SetupComplete.cmd file in the %WINDIR%\Setup\Scripts\ directory. 2. If a SetupComplete.cmd file is found, Windows Setup runs the script. Windows Setup logs the action in the C:\Windows\Panther\UnattendGC\Setupact.log file. 3. Setup does not verify any exit codes or error levels in the script after it executes SetupComplete.cmd. 4. If the computer joins a domain during installation, the Group Policy that is defined in the domain is not applied to the computer until Setupcomplete.cmd is finished. This is to make sure that the Group Policy configuration activity does not interfere with the script. Reference - https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-a-custom-script-to-windows-setup?view=windows-11

pal40sgOption: C
Oct 9, 2023

In the context of Azure and hybrid environments, the best solution for ensuring that your PowerShell scripts are run on newly created VMs is option C: Configure a Group Policy Object (GPO) to run the scripts as startup scripts. Here's why: A. SetupComplete.cmd in %windir%\setup\scripts: This method is typically used for unattended installations, but it won't work for your scenario as it's mainly used during the initial setup phase of Windows.

photon99
Oct 20, 2023

This question is more oriented towards Active Directory Administartion than Azure AZ 104 at all !

3c5adceOption: C
May 11, 2024

Between A & C - ChatGPT4 says C. The option A, using a SetupComplete.cmd batch file, is primarily intended for tasks that need to be executed once after the operating system is installed or configured. While it can technically run scripts post-setup, it's less flexible and manageable compared to using Group Policy. Option C, configuring a Group Policy Object (GPO) to run scripts as startup scripts, provides better manageability and scalability. With GPOs, you can easily update, manage, and apply scripts across multiple VMs in the domain automatically every time the machines start up, not just after initial setup. This makes it more suitable for ongoing operations and management in a hybrid environment like yours.

DidatziOption: C
May 20, 2024

Answer A is valid. Answer C is also valid, if you have the VM's joined to the AD domain. It is better to manage VM's with GPO instead of running scripts manually on each VM. Using GPO will minimize the effort and will save time. I personally prefer answer C. Here, the questions does not provide enough information to choose the correct answer between the two.

mmissaoui97
Sep 22, 2023

i just passed the exam today and got 660/700 :/ unfortunetly most of the questions where long user cases with lot of tables and screenshots it take too much time to read and understand and lot of tricky sentences that distracts you ...the main subject was pub/priv dns with autoregistration from vnets.. azure bastion ... storage accounts ... NSGs/Vnet/subnets..VMSS scaling...AD roles and policies..the questions weren't hard but very long... i'm planning to repass it next week ...if anyone of you has the recent questions please send it to me : <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cea8a1bbaaa6afa7a2b7af8ea9a3afa7a2e0ada1a3">[email protected]</a>

insanetechy
Sep 26, 2023

hi, if you get any recent questions please forward them on <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="761f18051718130213151e0f36111b171f1a5815191b">[email protected]</a>. I have registered for exam on 5th oct. please help. also if anyone has contributor access please forward questions and answers on the same email ID. I appreciate for the help.

Lynthel
Oct 1, 2023

Looking for any help as well. Please forward to <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="84eee1f6f6fdc4e6f6ede3ecf0ede0e1e5f7f1f7e5aaeae1f0">[email protected]</a>

insanetechyOption: C
Sep 26, 2023

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? option A applies scripts on the new VM's first boot whereas option C applies on new VMs every boot. here the keyword is "some PowerShell scripts" so that is more than one script and not one. So it might involve scripts to be applied on every boot. Therefore the answer is C and not A.

MelKrOption: C
Mar 20, 2024

Group policies can be replicated to Azure AD. The question does not state where the new VMs will be created (On Prem or in Azure). So Group Policies is the only option that works for both.

76d5e04
May 29, 2024

Many windows server administration related questions are poping up, seems unrelevant

yashsjOption: C
Sep 17, 2023

The question has setup a context stating use of hybrid use of Azure AD with OnPrem Active Directory Domain Controller. So option C seems to be correct option as it uses the information/context provided in the question. Option A might be correct option (although that can also be debated) has noting to do with Azure.

nospamplsOption: C
Feb 26, 2024

https://chat.openai.com/share/c4dac4a9-0e79-4c30-bb6c-36239bc9e32e

Amir1909Option: A
Feb 26, 2024

A is correct

chucklu
Jul 17, 2024

The second link provided in Answer does not work, should be https://azure.microsoft.com/de-de/blog/automating-vm-customization-tasks-using-custom-script-extension/