You need to ensure that the scripts are executed on new VMs

You develop a set of Power Shell scripts that will run when you deploy new virtual machines (VMs).
You need to ensure that the scripts are executed on new VMs. You want to achieve this goal by using the least
amount of administrative effort.
What should you do?

You develop a set of Power Shell scripts that will run when you deploy new virtual machines (VMs).
You need to ensure that the scripts are executed on new VMs. You want to achieve this goal by using the least
amount of administrative effort.
What should you do?

A.
Create a new GPO to execute the scripts as a logon script.

B.
Create a SetupComplete.cmd batch file to call the scripts after the VM starts.

C.
Create a new virtual hard disk (VHD) that contains the scripts.

D.
Load the scripts to a common file share accessible by the VMs.

E.
Set the VMs to execute a custom script extension.

Explanation:
After you deploy a Virtual Machine you typically need to make some changes before it’s ready to use. This is
something you can do manually or you could use Remote PowerShell to automate the configuration of your VM
after deployment for example.
But now there’s a third alternative available allowing you customize your VM: the CustomScriptextension.
This CustomScript extension is executed by the VM Agent and it’s very straightforward: you specify which files it
needs to download from your storage account and which file it needs to execute. You can even specify
arguments that need to be passed to the script. The only requirement is that you execute a .ps1 file.
http://azure.microsoft.com/blog/2014/04/24/automating-vm-customization-tasks-using-customscript-extension/



Leave a Reply 2

Your email address will not be published. Required fields are marked *


zapper

zapper

Custom script extension are listed as ” This extension is useful for post deployment configuration, software installation, or any other configuration / management task “. Whereas the above states “new virtual machines”. So why wouldn’t SetupComplete.cmd be as better response?

qwfi@flw.lf

[email protected]

I’m struggling with this one as well. I’d still go for E) though. We need to minimize effort. If you use SetupComplete.cmd you need to make sure this file is located at %WINDIR%\Setup\Scripts\SetupComplete.cmd immediately after setup. There’s no quick way to get the file in this folder before the setup, unless you create an on-premises VM, add the SetupComplete.cmd and then sysprep it and upload the VHD to azure.

https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-a-custom-script-to-windows-setup

E) is alot quicker and basically does the same thing.