Extended Get-NotesDetails Function

Topics: Archive - Toolkit Extensions
Dec 1, 2014 at 10:05 AM
Find below an extended Get-NotesDetails function that returns more information about the IBM Notes installation.

The additional logic returns:
  • InstallType
    Read from the Notes.INI returns either "2" for All-Client or "6" for Client-Only"
  • Hotfix
    Returns details of the installed Fix Pack (FP) and Standard Hot Fix (SHF)
  • RunningProcesses
    Uses the PID.NBF to identify the running processes associated with Notes
To use this replace the existing function in the AppDeployToolkitExtensions.ps1.
Function Get-NotesDetails {

    # Gather details of existing installation from the registry and notes.ini.
    # In addition current active Notes processes from PID.nsf
    Write-Log "Getting Notes version details"
    
    $notesRegistryPath = "HKLM:\SOFTWARE\Wow6432Node\Lotus\Notes"
    $notesHotfixPath = "HKLM:\SOFTWARE\Wow6432Node\IBM\Lotus\Expeditor\*"
    $notesRegex = "\w+\.exe"
    
    If (Test-Path $notesRegistryPath) {
        $notesDetails = New-Object PSObject
        $notesRegistry = Get-RegistryKey $notesRegistryPath
        Write-Log "Notes installation detected from the registry."
        $notesDetails | Add-Member -MemberType NoteProperty -Name Description -Value $notesRegistry.Description
        Write-Log ("Description: " + $notesRegistry.Description)
        $notesDetails | Add-Member -MemberType NoteProperty -Name Version -Value $notesRegistry.Version
        Write-Log ("Version: " + $notesRegistry.Version)
        $notesDetails | Add-Member -MemberType NoteProperty -Name Path -Value $notesRegistry.Path
        Write-Log ("Path: " + $notesRegistry.Path)
        $notesDetails | Add-Member -MemberType NoteProperty -Name DataPath -Value $notesRegistry.DataPath
        Write-Log ("DataPath: " + $notesRegistry.DataPath)
        
        If (Test-Path -Path (Join-Path $notesRegistry.Path "\*") -Include "notes.ini") {
            Write-Log ("Notes.INI detected in: " + $notesRegistry.Path)
            $notesDetails | Add-Member -MemberType NoteProperty -Name NotesINIPath -Value (Join-Path $notesRegistry.Path "notes.ini")
            $notesDetails | Add-Member -MemberType NoteProperty -Name InstallType -Value (Get-IniValue -FilePath (Join-Path $notesRegistry.Path "notes.ini") -Section "Notes" -Key "InstallType")
        }

        If (Test-Path $notesHotFixPath) {
            $notesHotfix = Get-RegistryKey $notesHotfixPath
            Write-Log "Notes Hotfix detected from the registry."
            If ($notesHotfix.xpdHotfixVersion -ne $null) {
                $notesDetails | Add-Member -MemberType NoteProperty -Name Hotfix -Value $notesHotfix.xpdHotfixVersion
                Write-Log ("Hotfix Version: " + $notesHotfix.xpdHotfixVersion)
            }
        }

        If (Test-Path -Path (Join-Path $notesRegistry.DataPath "\*") -Include "pid.nbf") {
            Write-Log ("PID.nbf detected in: " + $notesRegistry.DataPath)
            $notesDetails | Add-Member -MemberType NoteProperty -Name RunningProcesses -Value (Select-String (Join-Path $notesRegistry.DataPath "pid.nbf") -pattern $notesRegex | % {$_.Matches} | % {$_.Value})
            Write-Log "Notes Processes detected: $($NotesDetails.RunningProcesses -join ",")"
        }
        Else {
            Write-Log "Notes Processes not detected"
            $notesDetails | Add-Member -MemberType NoteProperty -Name RunningProcesses -Value ""
        }

        Return $notesDetails
    }
    
    Else {
        Write-Log "Notes installation not found."
        Return $null
    }

}