diff --git a/install-service.ps1 b/install-service.ps1 index 4fe09a6..4e2caf3 100644 --- a/install-service.ps1 +++ b/install-service.ps1 @@ -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" diff --git a/uninstall-service.ps1 b/uninstall-service.ps1 index 1dc179c..8a5d7ed 100644 --- a/uninstall-service.ps1 +++ b/uninstall-service.ps1 @@ -1,4 +1,8 @@ -#Requires -Version 6.0 +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))