|
44 | 44 | "script": [ |
45 | 45 | "$path_regex = [regex]::Escape((Split-Path -Path $dir -Parent))", |
46 | 46 | "Stop-Process -Name 'SimpleDnsCrypt' -Force -ErrorAction SilentlyContinue", |
47 | | - "$service = Get-Service -Include '*dnscrypt-proxy*' -ErrorAction SilentlyContinue", |
| 47 | + "if ($PSVersionTable.PSVersion -lt [version]::new(6, 0)) {", |
| 48 | + " $name_filter = 'Name like ''%dnscrypt-proxy%'''", |
| 49 | + " $service = Get-CimInstance -ClassName Win32_Service -Filter $name_filter -ErrorAction SilentlyContinue |", |
| 50 | + " Select-Object -Property *, @{ Name = 'BinaryPathName'; Expression = { $_.PathName } }", |
| 51 | + "} else {", |
| 52 | + " $service = Get-Service -Name '*dnscrypt-proxy*' -ErrorAction SilentlyContinue", |
| 53 | + "}", |
48 | 54 | "if ($null -eq $service -or $service.BinaryPathName -notmatch $path_regex) { return }", |
49 | 55 | "if (-not (is_admin)) { abort \"`n[ERROR] $app requires admin rights to $cmd.\" }", |
50 | 56 | "Stop-Service -Name $service.Name -Force -ErrorAction SilentlyContinue", |
51 | | - "Stop-Process -Name $service.Name -Force -ErrorAction SilentlyContinue", |
| 57 | + "Stop-Process -Name 'dnscrypt-proxy' -Force -ErrorAction SilentlyContinue", |
52 | 58 | "Start-Sleep -Milliseconds 1500", |
53 | 59 | "if ($cmd -ne 'uninstall') { return }", |
54 | 60 | "if ($PSVersionTable.PSVersion -lt [version]::new(6, 0)) {", |
|
0 commit comments