Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <powershell>
- if ( Get-Service "AWSXRayDaemon" -ErrorAction SilentlyContinue ) {
- sc.exe stop AWSXRayDaemon
- sc.exe delete AWSXRayDaemon
- }
- $targetLocation = "C:\Program Files\Amazon\XRay"
- if ((Test-Path $targetLocation) -eq 0) {
- mkdir $targetLocation
- }
- $zipFileName = "aws-xray-daemon-windows-service-3.x.zip"
- $zipPath = "$targetLocation\$zipFileName"
- $destPath = "$targetLocation\aws-xray-daemon"
- if ((Test-Path $destPath) -eq 1) {
- Remove-Item -Recurse -Force $destPath
- }
- $daemonPath = "$destPath\xray.exe"
- $daemonLogPath = "$targetLocation\xray-daemon.log"
- $url = "https://s3.dualstack.ap-southeast-1.amazonaws.com/aws-xray-assets.ap-southeast-1/xray-daemon/aws-xray-daemon-windows-service-3.x.zip"
- Invoke-WebRequest -Uri $url -OutFile $zipPath
- Add-Type -Assembly "System.IO.Compression.Filesystem"
- [io.compression.zipfile]::ExtractToDirectory($zipPath, $destPath)
- New-Service -Name "AWSXRayDaemon" -StartupType Automatic -BinaryPathName "`"$daemonPath`" -f `"$daemonLogPath`""
- sc.exe start AWSXRayDaemon
- </powershell>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement