Skip to content

Commit 9659b96

Browse files
Updated launchInstaller.ps1 to be Async #39
1 parent e8d3d4a commit 9659b96

2 files changed

Lines changed: 41 additions & 36 deletions

File tree

Agent/LaunchInstaller.ps1

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -80,46 +80,45 @@ if ($null -eq $p) {
8080
else {
8181
Write-Host "Successfully launched $TempFolder\InstallAgent.ps1 with $($args.Count) arguments" -ForegroundColor Green
8282
Write-EventLog -EntryType Information -EventId 10 -LogName Application -Source $LauncherScript -Message "Successfully launched $TempFolder\InstallAgent.ps1 with $($args.Count) arguments" > $null
83-
}
84-
85-
Write-Host "Launched InstallAgent with PID: $($p.Id), waiting on Exit"
86-
$RegPaths = @{
87-
Summary = "HKLM:\SOFTWARE\N-able Community\InstallAgent"
88-
Installation = "HKLM:\SOFTWARE\N-able Community\InstallAgent\Installation"
89-
Diagnosis = "HKLM:\SOFTWARE\N-able Community\InstallAgent\Diagnosis"
90-
}
9183

92-
while (-not $p.HasExited) {
9384
if ($Monitor.IsPresent) {
94-
Start-Sleep 1
95-
Clear-Host
96-
if (Test-Path $RegPaths.Summary) {
97-
Write-Host "Progress: " -ForegroundColor Green -NoNewline
98-
Get-ItemProperty $RegPaths.Summary | Select-Object * -ExcludeProperty PS* | Format-List *
85+
86+
Write-Host "Launched InstallAgent with PID: $($p.Id), waiting on Exit"
87+
$RegPaths = @{
88+
Summary = "HKLM:\SOFTWARE\N-able Community\InstallAgent"
89+
Installation = "HKLM:\SOFTWARE\N-able Community\InstallAgent\Installation"
90+
Diagnosis = "HKLM:\SOFTWARE\N-able Community\InstallAgent\Diagnosis"
9991
}
100-
}
101-
else {
102-
Start-Sleep 10
103-
}
104-
}
105-
if ($p.ExitCode -eq 0) {
106-
Write-Host "Script ran successfully, displaying registry results:" -ForegroundColor Green
107-
$RegPaths.Keys | ForEach-Object {
108-
if (Test-Path $RegPaths[$_]) {
109-
Write-Host "$($_): " -ForegroundColor Green -NoNewline;
110-
Get-ItemProperty $RegPaths[$_] | Select-Object * -ExcludeProperty PS* | Format-List *
92+
93+
while (-not $p.HasExited) {
94+
Start-Sleep 1
95+
Clear-Host
96+
if (Test-Path $RegPaths.Summary) {
97+
Write-Host "Progress: " -ForegroundColor Green -NoNewline
98+
Get-ItemProperty $RegPaths.Summary | Select-Object * -ExcludeProperty PS* | Format-List *
99+
}
111100
}
112-
}
113-
Write-Host "Check logs for additional details"
114-
}
115-
else {
116-
Write-Host "Script ran successfully, displaying registry results:"
117-
$RegPaths.Keys | ForEach-Object {
118-
if (Test-Path $RegPaths[$_]) {
119-
Write-Host "$($_): " -ForegroundColor Green -NoNewline;
120-
Get-ItemProperty $RegPaths[$_] | Select-Object * -ExcludeProperty PS* | Format-List *
101+
if ($p.ExitCode -eq 0) {
102+
Write-Host "Script ran successfully, displaying registry results:" -ForegroundColor Green
103+
$RegPaths.Keys | ForEach-Object {
104+
if (Test-Path $RegPaths[$_]) {
105+
Write-Host "$($_): " -ForegroundColor Green -NoNewline;
106+
Get-ItemProperty $RegPaths[$_] | Select-Object * -ExcludeProperty PS* | Format-List *
107+
}
108+
}
109+
Write-Host "Check logs for additional details"
121110
}
111+
else {
112+
Write-Host "Script ran successfully, displaying registry results:"
113+
$RegPaths.Keys | ForEach-Object {
114+
if (Test-Path $RegPaths[$_]) {
115+
Write-Host "$($_): " -ForegroundColor Green -NoNewline;
116+
Get-ItemProperty $RegPaths[$_] | Select-Object * -ExcludeProperty PS* | Format-List *
117+
}
118+
}
119+
Write-Host "Check logs for additional details"
120+
Write-EventLog -EntryType Error -EventId 13 -LogName Application -Source $LauncherScript -Message "$SetupScript encountered an error starting the launcher" > $null
121+
}
122+
122123
}
123-
Write-Host "Check logs for additional details"
124-
Write-EventLog -EntryType Error -EventId 13 -LogName Application -Source $LauncherScript -Message "$SetupScript encountered an error starting the launcher" > $null
125124
}

ReleaseNotes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2021-05-7 - 6.0.2
2+
* Fixed bug with Invoke-Webrequest not working due to absence of -UseBasicParsing per [#36](https://github.com/AngryProgrammerInside/InstallAgent/issues/36)
3+
* Added forced removal/cleanup when bad MSI uninstall information or MSI unable to remove old/rogue agent when needed. [#37](https://github.com/AngryProgrammerInside/InstallAgent/issues/37)
4+
* Fixed bug with InstallAgent process not being spun off Async unless -Monitor flag used [#39](https://github.com/AngryProgrammerInside/InstallAgent/issues/39)
5+
6+
17
# 2021-04-12 - 6.0.1
28

39
## Fixes

0 commit comments

Comments
 (0)