-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust service install script to require PS Core
- Loading branch information
Showing
2 changed files
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
if ($PSEdition -neq "Core") { | ||
Write-Host "This script requires PowerShell Core. Get it here: https://github.com/powershell/powershell#get-powershell" | ||
$HOST.UI.RawUI.ReadKey(“NoEcho,IncludeKeyDown”) | OUT-NULL | ||
$HOST.UI.RawUI.Flushinputbuffer() | ||
} | ||
|
||
# Ensure that the script is elevated | ||
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) | ||
{ | ||
# Relaunch as an elevated process: | ||
Start-Process powershell "-ExecutionPolicy","Unrestricted","-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs | ||
Start-Process pwsh "-ExecutionPolicy","Unrestricted","-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs | ||
exit | ||
} | ||
|
||
Set-Location -LiteralPath $PSScriptRoot | ||
# Create the service | ||
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 AutomaticDelayedStart | ||
# Immediately start the Service | ||
Start-Service -Name "AudioDGFix" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters