如何使用自定义扩展脚本在虚拟机上安装软件

时间:2019-12-25 07:03:37

标签: azure virtual-machine azure-powershell

我想使用自定义扩展脚本在虚拟机上安装软件(.msi文件)。

下面是我的powershell自定义扩展脚本。

$computername = 'testingpurpose'
$sourcefile = "//fossies.org/windows/misc/mysql-workbench-community-8.0.18-winx64.msi"
$destinationFolder = "\\$computername\C$\Temp"

Copy-Item -Path $sourcefile -Destination $destinationFolder 

Invoke-Command -ComputerName $computername -ScriptBlock { Msiexec /i //fossies.org/windows/misc/mysql-workbench-community-8.0.18-winx64.msi /log C:\MSIInstall.log }
                          (or)
Start-Process -destinationFolder //fossies.org/windows/misc/mysql-workbench-community-8.0.18-winx64.msi -ArgumentList '/i',$destinationFolder,'/q' -Wait -PassThru -Verb "RunAs"

1 个答案:

答案 0 :(得分:0)

根据我的研究,我们可以使用 files = [("file", io.BytesIO(data)] headers = {"Authorization": "bearer " + CLIENT.token} response = requests.request( "POST", SETTINGS.URL_FILE_STORAGE, headers=headers, files=files # files= [('file',catalogo)], ) 在Windows Vm上安装mysql-workbench。有关更多详细信息,请参阅blog

我的脚本如下

choco