Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 为什么Powershell';s Get ItemProperty返回的值与regedit.exe中的值不相同?_Windows_Azure_Powershell_Registry_Virtual Machine - Fatal编程技术网

Windows 为什么Powershell';s Get ItemProperty返回的值与regedit.exe中的值不相同?

Windows 为什么Powershell';s Get ItemProperty返回的值与regedit.exe中的值不相同?,windows,azure,powershell,registry,virtual-machine,Windows,Azure,Powershell,Registry,Virtual Machine,我正在设置一台用于测试的机器,其中一部分是修补一些注册表值。这是一个Azure虚拟机,我正在通过Powershell进行配置 我注意到从Get ItemProperty(在Powershell中)返回的注册表值与我在regedit.exe中看到的注册表值之间存在许多差异。以下是一个此类差异的示例: 获取项目属性: regedit.exe: 注意:在regedit.exe 我正在使用newitemproperty(带有-Force参数)设置这些属性 非常感谢您的帮助。我现在没有答案,但有一些想

我正在设置一台用于测试的机器,其中一部分是修补一些注册表值。这是一个Azure虚拟机,我正在通过Powershell进行配置

我注意到从
Get ItemProperty
(在Powershell中)返回的注册表值与我在
regedit.exe
中看到的注册表值之间存在许多差异。以下是一个此类差异的示例:

获取项目属性

regedit.exe

注意:在
regedit.exe

我正在使用
newitemproperty
(带有
-Force
参数)设置这些属性


非常感谢您的帮助。

我现在没有答案,但有一些想法可以尝试一下

使用命令行列出所有键

reg.exe query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
使用PowerShell列出所有密钥

(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\").PSObject.Properties | where-object name -notlike PS* | Format-Table Name, value
((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\").PSObject.Properties | where-object name -notlike PS*).count
这将使您更容易比较PowerShell生成的结果和命令行生成的结果

要统计PowerShell中的条目数

(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\").PSObject.Properties | where-object name -notlike PS* | Format-Table Name, value
((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\").PSObject.Properties | where-object name -notlike PS*).count
我用两台不同的笔记本电脑进行了测试,没有发现任何差异

我对4个不同的Azure虚拟机进行了测试,没有发现任何差异

如果您正在创建新的注册表项,我会在再次检索注册表项之前重新启动PowerShell控制台。只是为了确定一下


另外,您应该考虑从ReGETD.EXE导出注册表项并查看文件中生成的路径。

我最常见的错误之一是认为当我实际上在另一个位置时,我在一个地方工作。所以您是否进行了双重和三重检查以确保它们都来自同一个位置?您是否尝试使用提升的权限运行PowerShell控制台?我以管理员身份运行PowerShell,是的,这是否相关?这里的问题正好相反。回答很好,谢谢
reg.exe查询
&
Get ItemProperty
在Powershell中具有相同的值。然而,注册表编辑器GUI是完全不同的。我注意到这只发生在最新版本的“2016数据中心”Azure映像中。使用以前的版本,没有问题。