/Build Scripts/service-script-pre.ps1

https://bitbucket.org/JonathanHope/mediaplayer · Powershell · 25 lines · 23 code · 2 blank · 0 comment · 5 complexity · ad8af237d3b81608866f9ffe19e19ae4 MD5 · raw file

  1. $Path = Test-Path C:\Users\Jonathan\Documents\Adrenochrome
  2. if (-not $Path)
  3. {
  4. New-Item C:\Users\Jonathan\Documents\Adrenochrome -type directory
  5. }
  6. $Path = Test-Path C:\Users\Jonathan\Documents\Adrenochrome\FilterPlugins
  7. if (-not $Path)
  8. {
  9. New-Item C:\Users\Jonathan\Documents\Adrenochrome\FilterPlugins -type directory
  10. }
  11. $Service = Get-Service -display "AdrenochromeService" -ErrorAction SilentlyContinue
  12. if (-not $Service)
  13. {
  14. exit
  15. }
  16. else
  17. {
  18. if (get-service "AdrenochromeService" | where-object {$_.status -eq "running"})
  19. {
  20. stop-service "AdrenochromeService"
  21. }
  22. installutil /u "C:\Users\Jonathan\Documents\Adrenochrome\AdrenochromeService.exe"
  23. }