powershell阅读注册表

时间:2013-08-22 09:02:11

标签: powershell registry

我有以下注册路径,我知道它存在,我在这里做错了吗?!

$path = 'Registry::HKLM\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\00000001'
Get-ChildItem $path | Get-ItemProperty | Select-Object -ExpandProperty "Service Name"

pshell返回:

Get-ChildItem : Cannot find path 'HKLM\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\00000001'
because it does not exist.

1 个答案:

答案 0 :(得分:1)

在我的机器上,钥匙存在于HKCU和HKU,而不是HKLM。你能尝试一下这个:

$path = 'HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\00000001'
Get-ItemProperty $path | Select-Object -ExpandProperty "Service Name"

Get-ChildItem只返回注册表中的子键,因此它不会为此路径返回任何内容。 http://technet.microsoft.com/en-us/library/ee176852.aspx