Skip to content

Commit 0069de9

Browse files
committed
Display logs + Check if installation successful
1 parent d637a1c commit 0069de9

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

scripts/Install-Rubberduck-VBA.ps1

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,75 @@ Invoke-WebRequest -Uri $rubberduckUrl -OutFile $tempInstallerPath
155155
$installerArgs = "/SILENT /NORESTART /SUPPRESSMSGBOXES /LOG=$env:TEMP\RubberduckInstall.log"
156156
Start-Process -FilePath $tempInstallerPath -ArgumentList $installerArgs -Wait
157157
# The -Wait parameter ensures that the script waits for the installation to complete before proceeding.
158+
159+
# Output logs to the console
160+
# The script uses the Get-Content cmdlet to read the installation log file and display its contents in the console.
161+
# This can help troubleshoot any issues that may arise during the installation process.
162+
# Note: Use -Tail 500 to limit the output to the last 500 lines of the log file.
163+
Get-Content -Path "$env:TEMP\RubberduckInstall.log" | Out-Host
164+
165+
# Verify that Rubberduck was successfully installed by checking registry entries
166+
function Test-RubberduckInstalled {
167+
$addinProgId = "Rubberduck.Extension"
168+
$addinCLSID = "8D052AD8-BBD2-4C59-8DEC-F697CA1F8A66"
169+
$isInstalled = $false
170+
171+
# Check for registry keys in current user hive
172+
if (Test-Path "HKCU:\Software\Microsoft\VBA\VBE\6.0\Addins\$addinProgId") {
173+
Write-Host "✅ Rubberduck add-in registration found in HKCU VBA\VBE registry."
174+
$isInstalled = $true
175+
}
176+
177+
# For 64-bit systems, check additional registry locations
178+
if ([Environment]::Is64BitOperatingSystem) {
179+
if (Test-Path "HKCU:\Software\Microsoft\VBA\VBE\6.0\Addins64\$addinProgId") {
180+
Write-Host "✅ Rubberduck add-in registration found in HKCU VBA\VBE Addins64 registry."
181+
$isInstalled = $true
182+
}
183+
184+
# Check for the VB6 addin registration
185+
if (Test-Path "HKCU:\Software\Microsoft\Visual Basic\6.0\Addins\$addinProgId") {
186+
Write-Host "✅ Rubberduck add-in registration found in HKCU Visual Basic registry."
187+
$isInstalled = $true
188+
}
189+
}
190+
191+
# Check for the COM class registration
192+
if (Test-Path "HKCR:\CLSID\{$addinCLSID}" -ErrorAction SilentlyContinue) {
193+
Write-Host "✅ Rubberduck COM class registration found."
194+
$isInstalled = $true
195+
}
196+
197+
# Check if the DLL file was installed
198+
$commonAppDataPath = [System.Environment]::GetFolderPath("CommonApplicationData")
199+
$localAppDataPath = [System.Environment]::GetFolderPath("LocalApplicationData")
200+
201+
$possiblePaths = @(
202+
"$commonAppDataPath\Rubberduck\Rubberduck.dll",
203+
"$localAppDataPath\Rubberduck\Rubberduck.dll"
204+
)
205+
206+
foreach ($path in $possiblePaths) {
207+
if (Test-Path $path) {
208+
Write-Host "✅ Rubberduck DLL found at: $path"
209+
$isInstalled = $true
210+
break
211+
}
212+
}
213+
214+
if (-not $isInstalled) {
215+
Write-Host "❌ Rubberduck installation verification failed. No registry entries or DLL files found."
216+
return $false
217+
}
218+
219+
Write-Host "✅ Rubberduck installation verification completed successfully."
220+
return $true
221+
}
222+
223+
$rubberduckInstalled = Test-RubberduckInstalled
224+
if (-not $rubberduckInstalled) {
225+
Write-Host "⚠️ Warning: Rubberduck installation could not be verified. Office addins may not function correctly."
226+
Write-Host "Please check the installation log for more details or try reinstalling manually."
227+
} else {
228+
Write-Host "🎉 Rubberduck installed successfully and is ready to use!"
229+
}

0 commit comments

Comments
 (0)