如何使用Azure函数,Runbook或Azure Powershell在Azure虚拟机中执行程序?

问题描述

有时我需要一天在Azure的Windows虚拟机上启动一个应用程序/文件,并且我不想在需要运行RDP连接时执行此操作。因此,我想知道是否可以在Powershell中创建Azure函数,Runbook(自动化)或脚本来打开此应用程序/文件(如果可能的话,还可以安排时间表)。

我在Automation Runbooks上尝试了以下脚本,但是没有用:

$Conn = Get-AutomationConnection -Name AzureRunAsConnection
Add-AzureRMAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint
$VMs = Get-AzureRMVM | where {$_.Tags.Values -like '*TaggedMachine*'} 
$VMs | Start-Process -FilePath "notepad.exe"
Write-Output $VMs.Name

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)