Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure Automation Powershell runbook未能加载程序集 我在azure portal上运行的代码 输出_Azure_Powershell_Azure Automation - Fatal编程技术网

Azure Automation Powershell runbook未能加载程序集 我在azure portal上运行的代码 输出

Azure Automation Powershell runbook未能加载程序集 我在azure portal上运行的代码 输出,azure,powershell,azure-automation,Azure,Powershell,Azure Automation,对此有何想法?要加载.dll程序集,您可以参考以下步骤 1.在门户->模块->添加模块中导航到您的自动化帐户,将Microsoft.ApplicationInsights.dll文件压缩到Microsoft.ApplicationInsights.zip,然后上载。上传后,您将在门户中找到它 2.更改$assemblyPath,您的完整命令应如下所示,它将正常工作 Write-Output "Starting" $assemblyPath = "C:\Modules\User\Microsof


对此有何想法?要加载
.dll
程序集,您可以参考以下步骤

1.在门户->模块->添加模块中导航到您的自动化帐户,将
Microsoft.ApplicationInsights.dll
文件压缩到
Microsoft.ApplicationInsights.zip
,然后上载。上传后,您将在门户中找到它

2.更改
$assemblyPath
,您的完整命令应如下所示,它将正常工作

Write-Output "Starting"
$assemblyPath = "C:\Modules\User\Microsoft.ApplicationInsights\Microsoft.ApplicationInsights.dll"
dir $assemblyPath

Write-Output "1"        
Add-Type -Path $assemblyPath
Write-Output "2"
输出


当然失败了,如果从azure portal运行,则没有路径。您应该从您的本地pc上运行它,该pc可以指向您指定的路径。@IvanYang表示在azure portal中无法执行此操作。您可以更清楚地解释,例如在
add type
cmdlet之后,您下一步要执行什么操作?我需要使用azure portal运行此操作。我该怎么办?@IvanYang我想用exchange服务而不是SMTP发送邮件非常感谢您的回答。但我还有一个问题,我想用exchange服务而不是SMTP发送邮件。我使用了Microsoft.Exchange.WebServices.dll,它有发送EWSmail的功能,但不起作用。”$Credential=Get AutomationPSCredential-名称'ServiceAccount'发送EWSmail-至“**@gmail.com”-主题为“自动邮件”-正文为“PowerShell和Exchange rock!”-Credential$Credential'请帮助我,请再次查看上述评论。请help@SumitGarg要使用
发送电子邮件
,只需转到
浏览库
并导入模块,请参阅:是的,谢谢,我的问题已解决。我用发送电子邮件代替发送电子邮件
Write-Output "Starting"
$assemblyPath = "C:\Modules\User\Microsoft.ApplicationInsights\Microsoft.ApplicationInsights.dll"
dir $assemblyPath

Write-Output "1"        
Add-Type -Path $assemblyPath
Write-Output "2"