Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$Command = {
New-Service -Name MackerelAgentService -BinaryPathName 'C:\Program Files\Windows Resource Kits\Tools\srvany.exe'
New-Item -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\MackerelAgentService\Parameters'
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\MackerelAgentService\Parameters' -Name Application 'C:\Go\bin\mackerel-agent.exe -conf C:\mackerel-agent\mackerel-agent.conf -root C:\mackerel-agent'
Write-Host '`Start-Service MackerelAgentService` to start service'
Start-Process PowerShell -ArgumentList "-NoExit -Command & { $Command }" -Verb RunAs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.