Skip to content

Commit

Permalink
Fix install scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
nike4613 committed Mar 29, 2021
1 parent ab0c18c commit ef25ee4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Either run the executable directly each time you start your computer, or run
& .\install-service.ps1
```

in the publish output in Powershell Core to install it as a service. `.\uninstall-service.ps1` can
be used to stop and remove the service.
in the publish output in Powershell to install it as a service. `.\uninstall-service.ps1` can
be used to stop and remove the service, but it must be run from Powershell Core.
7 changes: 4 additions & 3 deletions install-service.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
# Relaunch as an elevated process:
Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
Start-Process powershell "-ExecutionPolicy","Unrestricted","-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
exit
}

Set-Location -LiteralPath $PSScriptRoot
# Create the service
$svc = New-Service -Name "AudioDGFix" -BinaryPathName "$(resolve-path .\AudioDGFix.exe) -s" -DependsOn "audiosrv" -StartupType Automatic
New-Service -Name "AudioDGFix" -BinaryPathName "`"$(resolve-path .\AudioDGFix.exe)`" -s" -DependsOn "audiosrv" -StartupType Automatic
# Immediately start the Service
Start-Service $svc
Start-Service -Name "AudioDGFix"
2 changes: 1 addition & 1 deletion uninstall-service.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
# Relaunch as an elevated process:
Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
Start-Process pwsh "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
exit
}

Expand Down

0 comments on commit ef25ee4

Please sign in to comment.