我正在尝试从特定键返回注册表值。由于某种原因,我无法获得密钥的字符串值。我可以得到DWordValue没问题。
有谁能告诉我为什么字符串值不会返回?
代码:
function getRegistry(){
Param (
[string]$hklm = "2147483650",
[string]$key = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run",
[string]$Value2 = "ConnectionCenter"
)
$credential = Get-Credential
$test | ForEach-Object {
$wmi = Get-WmiObject -List "StdRegProv" -Namespace root\default -ComputerName "compName" -Credential $credential
#($wmi.GetStringValue($hklm, $key, $value)).sValue
$wmi.GetStringValue($hklm, $key, $Value2)
}
}
getRegistry