mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
fix(windows): register the notification shortcut identity
This commit is contained in:
3 files changed
+64
-1
No files matched your search
@@ -24,6 +24,12 @@ $service = Get-CimInstance Win32_Service -Filter "Name='GPConnect'"
|
||||
if ($service.State -ne 'Running' -or $service.StartMode -ne 'Auto' -or $service.StartName -ne 'LocalSystem') {
|
||||
throw 'The service did not start automatically as LocalSystem.'
|
||||
}
|
||||
$shortcut = Join-Path $env:ProgramData 'Microsoft\Windows\Start Menu\Programs\GP Connect.lnk'
|
||||
$shell = New-Object -ComObject Shell.Application
|
||||
$link = $shell.Namespace((Split-Path $shortcut)).ParseName((Split-Path $shortcut -Leaf))
|
||||
if (!$link -or $link.ExtendedProperty('System.AppUserModel.ID') -ne 'com.yuezk.gpgui') {
|
||||
throw 'The Start menu shortcut does not register the notification application identity.'
|
||||
}
|
||||
foreach ($name in @('gpgui.exe', 'gpauth.exe')) {
|
||||
$process = Start-Process (Join-Path $destination $name) -ArgumentList '--version' -PassThru -Wait
|
||||
if ($process.ExitCode -ne 0) { throw "The installed $name cannot start." }
|
||||
@@ -44,7 +50,6 @@ if ($process.ExitCode -ne 0) { throw 'The uninstaller failed.' }
|
||||
if ((Get-Service GPConnect -ErrorAction SilentlyContinue) -or (Test-Path $destination) -or (Test-Path ($destination + '.previous'))) {
|
||||
throw 'The uninstaller left service registration or runtime files.'
|
||||
}
|
||||
$shortcut = Join-Path $env:ProgramData 'Microsoft\Windows\Start Menu\Programs\GP Connect.lnk'
|
||||
if ((Test-Path $shortcut) -or (Test-Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPConnect')) {
|
||||
throw 'The uninstaller left its shortcut or registration.'
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user