获取安装了exe文件的程序的guid

时间:2017-03-08 03:00:21

标签: powershell guid dsc

我想知道如何找到并选择

中未列出的程序的指南
gcim win32_product

我希望能够选择名称和产品ID / guid,然后将它们用于第二部分。到目前为止我所拥有的:

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

guid被多次列出,但我现在不知道如何“抓住”或从括号中选择它

1 个答案:

答案 0 :(得分:0)

我能够弄明白,它略显粗糙,但它显示了我需要的信息。

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
}