简体   繁体   中英

Azure add vm agent to Virtual machine created from special VHD

I have a VM from a special VHD file. This VM was not created through code (in which case it would already have the vm agent installed).

This special VHD has Windows 7, but obviously not the vm agent inside it. How can I automatically install the VM agent to this vm(I know you can manually do it by downloading the MSI file from https://go.microsoft.com/fwlink/?LinkID=394789&clcid=0x409 , and installing the agent, but I'm looking for a programmatic solution, perhaps powershell)?

How can I automatically install the VM agent to this vm?

We can use PowerShell to install Azure VM agent, but the VM should be running and can connect to the internet.

we can use this powershell script to install it:

#download msi file:
Invoke-WebRequest -Uri "http://go.microsoft.com/fwlink/?LinkID=394789" -OutFile $env:temp\agent.msi
cd $env:temp
# unattended installation of the VM agent
msiexec.exe /i agent.msi /quiet

Like this: 在此处输入图片说明

After few minutes, we can find the agent here. 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM