Script to install in the VM during configuration

Varma 1,170 Reputation points
2024-04-21T12:17:51.1666667+00:00

I have following script ,

Script includes following steps:

  1. Download respective link ( I have already have got that)
  2. .\WindowsSensor_7.03.17506.exe /install /quiet /norestart CID=XXXXX --GROUPING_TAGS="DOMAIN"

I want this to be installed in the VM. I have not created VM yet, but once I create VM i should see above script should be already installed, is it possible? if yes how?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,158 questions
{count} votes

1 answer

Sort by: Most helpful
  1. vipullag-MSFT 24,206 Reputation points Microsoft Employee
    2024-04-22T04:37:27.8066667+00:00

    Hello Varma

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    If you're creating VM's manually from the Azure portal and want to execute PowerShell commands on them immediately after creation without logging into the VM, you can use Azure Custom Script Extension.
    Ref: https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows

    While deploying the VM from Azure Portal, you can add the Extension.

    User's image

    Store your PowerShell script in a publicly accessible location, such as Azure Storage, GitHub, or any other publicly accessible URL.

    User's image

    Extension Details on the Azure Portal:

    User's image

    Provide the URL to your PowerShell script in the extension settings.
    Save the extension settings and proceed with the VM creation process.

    Once the VM is created, Azure will automatically execute the PowerShell script specified in the Custom Script Extension on the VM.

    By using Azure Custom Script Extension, you can automate the execution of PowerShell commands on Azure VMs immediately after they are created, without the need for manual intervention or logging into the VM.

    Hope this helps.
    If the suggested response helped you resolve your issue, please 'Accept as answer', so that it can help others in the community looking for help on similar topics.

    0 comments No comments