首页/系统/Windows 运维速查/读取远程注册表
本包目录(413 条)

读取远程注册表

不改远端机制读取 HKLM:reg query 一行搞定,或 PowerShell OpenRemoteBaseKey 做程序化读取。

Windows 运维速查系统更新于 2026-10-12
用途远程读注册表值
命令reg query \\host\HKLM\路径 /v 值名
PowerShell[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine','host')

常用示例

常用示例
# CMD 一行
reg query \\web01\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
# PowerShell 程序化
$base = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', 'web01')
$key = $base.OpenSubKey('SOFTWARE\Microsoft\Windows NT\CurrentVersion')
$key.GetValue('ProductName')
只读排查用;要改远端注册表请进 Invoke-Command 在本机内操作,改动更容易审计。

易错点

  • 依赖 Remote Registry 服务(客户端默认禁用、Server 手动),安全基线常关掉它
  • reg query 写 \\host\HKLM\…;写成 HKEY_LOCAL_MACHINE 会解析失败

数据来源与参考

  • Microsoft Learn:RegistryKey.OpenRemoteBaseKey
  • Microsoft Learn:reg query

相关工具

​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌