Advertisement
mobilefish

Untitled

Jan 30th, 2021
928
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <powershell>
  2. if ( Get-Service "AWSXRayDaemon" -ErrorAction SilentlyContinue ) {
  3.     sc.exe stop AWSXRayDaemon
  4.     sc.exe delete AWSXRayDaemon
  5. }
  6.  
  7. $targetLocation = "C:\Program Files\Amazon\XRay"
  8. if ((Test-Path $targetLocation) -eq 0) {
  9.     mkdir $targetLocation
  10. }
  11.  
  12. $zipFileName = "aws-xray-daemon-windows-service-3.x.zip"
  13. $zipPath = "$targetLocation\$zipFileName"
  14. $destPath = "$targetLocation\aws-xray-daemon"
  15. if ((Test-Path $destPath) -eq 1) {
  16.     Remove-Item -Recurse -Force $destPath
  17. }
  18.  
  19. $daemonPath = "$destPath\xray.exe"
  20. $daemonLogPath = "$targetLocation\xray-daemon.log"
  21. $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"
  22.  
  23. Invoke-WebRequest -Uri $url -OutFile $zipPath
  24. Add-Type -Assembly "System.IO.Compression.Filesystem"
  25. [io.compression.zipfile]::ExtractToDirectory($zipPath, $destPath)
  26.  
  27. New-Service -Name "AWSXRayDaemon" -StartupType Automatic -BinaryPathName "`"$daemonPath`" -f `"$daemonLogPath`""
  28. sc.exe start AWSXRayDaemon
  29. </powershell>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement