远程注册表值。返回字符串值

时间:2017-05-02 18:00:58

标签: powershell registry powershell-v5.0 registrykey remote-registry

我正在尝试从特定键返回注册表值。由于某种原因,我无法获得密钥的字符串值。我可以得到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

0 个答案:

没有答案