I'm new to Powershell Runbook, so forgive me if I'm missing something obvious. I'm trying to log an Application Insights request from my script, but can't even get the DLL to load, though I've seen other code out there that does something very similar. NOTE that this is a Powershell Runbook, not a Powershell Workflow Runbook.
Here's my code:
Write-Output "Starting"
$assemblyPath = "C:\Modules\Global\Azure\Compute\Microsoft.ApplicationInsights.dll"
dir $assemblyPath
Write-Output "1"
[System.Reflection.Assembly]::LoadFrom($assemblyPath)
Write-Output "2"
And here's the output I get when running it in the Test pane:
Starting
Directory: C:\Modules\Global\Azure\Compute
Mode LastWriteTime Length Name
---- ------------- ------ ----
------ 1/11/2016 1:59 PM 152824 Microsoft.ApplicationInsights.dll
1
Starting
Directory: C:\Modules\Global\Azure\Compute
Mode LastWriteTime Length Name
---- ------------- ------ ----
------ 1/11/2016 1:59 PM 152824 Microsoft.ApplicationInsights.dll
1
Starting
Directory: C:\Modules\Global\Azure\Compute
Mode LastWriteTime Length Name
---- ------------- ------ ----
------ 1/11/2016 1:59 PM 152824 Microsoft.ApplicationInsights.dll
1
It seems to get as far as the LoadAssembly and then craps out, running the script three times before giving up. Any ideas what I'm doing wrong? The DLL clearly exists at that location, and I'm not getting any error output to help me debug. Thanks!