Last active
August 29, 2015 14:22
-
-
Save robdmoore/d2b0fb0ae8f1ff104194 to your computer and use it in GitHub Desktop.
Install App Insights into Virtual Machine using PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Install-AppInsights($instrumentationKey) { | |
mkdir c:\tempappinsights -Force | |
pushd c:\tempappinsights | |
try { | |
(New-Object Net.WebClient).DownloadFile('http://appinsightsstatusmonitor.blob.core.windows.net/statusmonitor/ApplicationInsights.ps1.zip',"c:\tempappinsights\ApplicationInsights.ps1.zip") | |
Expand-ZipFile C:\tempappinsights\ApplicationInsights.ps1.zip c:\tempappinsights | |
. C:\tempappinsights\ApplicationInsights.ps1 | |
ApplicationInsightsConfig $instrumentationKey | |
Start-DscConfiguration -Path C:\tempappinsights\ApplicationInsightsConfig -ComputerName localhost | |
} finally { | |
popd | |
} | |
} | |
function Expand-ZIPFile($file, $destination) { | |
$shell = new-object -com shell.application | |
$zip = $shell.NameSpace($file) | |
foreach($item in $zip.items()) { | |
$shell.Namespace($destination).copyhere($item) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment