function Install-NewRelicServerMonitor { <# .SYNOPSIS Installs the New Relic Server Monitor #> [CmdletBinding()] Param( [Parameter(Mandatory = $false)] [Alias("Environment")] [string]$environmentKey ) $logLead = (Get-LogLeadName); $msiName = "NewRelicServerMonitor_x64.msi" $64bitMSIInstallerUrl = "https://download.newrelic.com/windows_server_monitor/release/NewRelicServerMonitor_x64_3.3.6.0.msi" $folderDateFormat = Get-Date -Format ddMMyyyy $outputFolder = ("C:\Temp\Deploy\NRServerMonitor_{0}" -f $folderDateFormat) $downloadedMsi = Get-PackageForInstallation $loglead $outputFolder $msiName $64bitMSIInstallerUrl $licenseKey = (Get-NewRelicAccountDetails $environmentKey).LicenseKey Write-Verbose ("$logLead : Using license key {0}" -f $licenseKey) $installParams = ("/i {0} /qn NR_LICENSE_KEY=`"{1}`"" -f $downloadedMsi, $licenseKey) Write-Verbose ("$logLead : Running msiexec.exe with parameters {0}" -f $installParams) $installProcess = Start-Process msiexec.exe -ArgumentList $installParams -NoNewWindow -PassThru -Wait Write-Output ("$logLead : Installation completed with exit code {0}" -f $installProcess.ExitCode) }