none
Getting the software unistall DisplayName from registry RRS feed

  • Question


  • We are doing software housekeeping on our Windows 2003 servers in preparation to migrate to higher release
    I need to retrieve the installed software from these boxes.

    Instead of the if statement below, I would like to use an array as follows. Thank you in advance.
    $OmitSoft = @("", "\(KB", "McAfee ", "HP ", "Service Pack", "IBM ", "Internet Explorer", .......,"VMware ")


    $UninstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"


        ForEach ($key in $SubKeys) {
            $thisKey = $UninstallKey+"\\"+$key
            $thisSubKey = $reg.OpenSubKey($thisKey)
            $DisplayName = $($thisSubKey.GetValue("DisplayName")).Trim()

            if (-not ($DisplayName -match "\(KB") -and ($DisplayName -ne "") -and ($DisplayName -match "McAfee") -and `
                     ($DisplayName -notmatch "HP ") -and ($DisplayName -notmatch "Internet Explorer")) {
               
                $ObjData = New-Object PsObject -Property  ([ordered]@{
                   "ServerName"  = $ComputerName
                   "Virtual"     = $Virtual
                   "OSName"      = $DisplayName
                   "OSVersion"   = $($thisSubKey.GetValue("DisplayVersion"))
                   "Description" = $($thisSubKey.GetValue("Publisher"))
                })

                Export-Csv -InputObject $ObjData -NoTypeInformation $CsvFile -Force -Append
            }
        }


    Learning PowerShell scripting

    Wednesday, August 27, 2014 7:45 PM

Answers

  • if($omitsoft -notcontains $displayname){
        ....


    ¯\_(ツ)_/¯

    • Proposed as answer by jrv Wednesday, August 27, 2014 8:05 PM
    • Marked as answer by Mario - Deer Park Thursday, August 28, 2014 12:01 AM
    Wednesday, August 27, 2014 8:05 PM

All replies