Search code examples
powershellguiddsc

Get guid of a program installed with an exe file


I am wondering how to find and select the guid of programs not listed in

gcim win32_product

I am hoping to be able to select the name and the product id / guid and then use them for a second part. What I have so far:

Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty 

The guid is listed many times but I do not now how to "grab" or select it from in between the brackets


Solution

  • I was able to figure it out, its slightly crude but it display the information I needed.

    function Get-Guid
    {
    Param(
    [parameter(Mandatory=$true)]
    [string]$Name
    )
    $path = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
    Get-ItemProperty -Path $path | Where-Object {$_.DisplayName -like "*$name*"} | select Displayname, ModifyPath
    }