99
1010$ErrorActionPreference = ' Stop'
1111$appName = ' GW Router Logger'
12- $version = ' 1.1.0 '
12+ $version = ' 1.1.1 '
1313$publisher = ' Ghostwheel'
1414
1515function Test-IsAdministrator {
@@ -30,6 +30,7 @@ function New-AppShortcut {
3030 param (
3131 [string ] $ShortcutPath ,
3232 [string ] $TargetScript ,
33+ [string ] $IconPath ,
3334 [switch ] $StartListener
3435 )
3536
@@ -44,6 +45,9 @@ function New-AppShortcut {
4445 $shortcut.Arguments = $arguments
4546 $shortcut.WorkingDirectory = Split-Path - Parent $TargetScript
4647 $shortcut.Description = ' Run GW Router Logger in the notification area'
48+ if (-not [string ]::IsNullOrWhiteSpace($IconPath ) -and (Test-Path - LiteralPath $IconPath )) {
49+ $shortcut.IconLocation = $IconPath
50+ }
4751 $shortcut.Save ()
4852}
4953
@@ -77,11 +81,17 @@ foreach ($file in $files) {
7781 Copy-Item - LiteralPath $source - Destination (Join-Path - Path $installRoot - ChildPath $file ) - Force
7882}
7983
84+ $sourceAssets = Join-Path - Path $sourceRoot - ChildPath ' assets'
85+ if (Test-Path - LiteralPath $sourceAssets ) {
86+ Copy-Item - LiteralPath $sourceAssets - Destination (Join-Path - Path $installRoot - ChildPath ' assets' ) - Recurse - Force
87+ }
88+
8089$programs = [Environment ]::GetFolderPath(' Programs' )
8190$shortcutFolder = Ensure- Directory - Path (Join-Path - Path $programs - ChildPath ' GW Router Logger' )
8291$trayScript = Join-Path - Path $installRoot - ChildPath ' GW-Router-Logger.Tray.ps1'
83- New-AppShortcut - ShortcutPath (Join-Path - Path $shortcutFolder - ChildPath ' GW Router Logger.lnk' ) - TargetScript $trayScript
84- New-AppShortcut - ShortcutPath (Join-Path - Path $shortcutFolder - ChildPath ' GW Router Logger - Start Listener.lnk' ) - TargetScript $trayScript - StartListener
92+ $iconPath = Join-Path - Path (Join-Path - Path $installRoot - ChildPath ' assets' ) - ChildPath ' gw-router-logger.ico'
93+ New-AppShortcut - ShortcutPath (Join-Path - Path $shortcutFolder - ChildPath ' GW Router Logger.lnk' ) - TargetScript $trayScript - IconPath $iconPath
94+ New-AppShortcut - ShortcutPath (Join-Path - Path $shortcutFolder - ChildPath ' GW Router Logger - Start Listener.lnk' ) - TargetScript $trayScript - IconPath $iconPath - StartListener
8595
8696$uninstallScript = Join-Path - Path $installRoot - ChildPath ' Uninstall-GWRouterLogger.ps1'
8797$uninstallCommand = ' "{0}" -NoProfile -ExecutionPolicy Bypass -File "{1}"' -f " $env: WINDIR \System32\WindowsPowerShell\v1.0\powershell.exe" , $uninstallScript
@@ -102,7 +112,7 @@ New-ItemProperty -Path $uninstallRoot -Name DisplayName -Value $appName -Propert
102112New-ItemProperty - Path $uninstallRoot - Name DisplayVersion - Value $version - PropertyType String - Force | Out-Null
103113New-ItemProperty - Path $uninstallRoot - Name Publisher - Value $publisher - PropertyType String - Force | Out-Null
104114New-ItemProperty - Path $uninstallRoot - Name InstallLocation - Value $installRoot - PropertyType String - Force | Out-Null
105- New-ItemProperty - Path $uninstallRoot - Name DisplayIcon - Value " $ env: WINDIR \System32\WindowsPowerShell\v1.0\powershell.exe " - PropertyType String - Force | Out-Null
115+ New-ItemProperty - Path $uninstallRoot - Name DisplayIcon - Value $iconPath - PropertyType String - Force | Out-Null
106116New-ItemProperty - Path $uninstallRoot - Name UninstallString - Value $uninstallCommand - PropertyType String - Force | Out-Null
107117New-ItemProperty - Path $uninstallRoot - Name QuietUninstallString - Value ($uninstallCommand + ' -Quiet' ) - PropertyType String - Force | Out-Null
108118New-ItemProperty - Path $uninstallRoot - Name EstimatedSize - Value $estimatedSize - PropertyType DWord - Force | Out-Null
0 commit comments