Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

windows - Unable to read a 64 bit registry key from a 32 bit version of win2008 using powershell

Im trying to read the below registry key on a 64 bit version of windows server 2008 r2 from a 32 bit windows 2008 using powershell, but the value comes as blank and does not return anyvalues.

can some help me on how can i read a 64 bit reg key from a 32 bit server ?

$line = "WIN-QENOBBC64B8"
$regkey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $line)
$ref = $regKey.OpenSubKey("SOFTWAREMicrosoftMicrosoft SQL ServerInstance NamesSQL")
$ref
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From 32bit powershell, you access the 64bit registry by calling the 64bit version of reg.exe from the command line. The trick is in using the sysnative path instead of system32, which gets you out of the syswow64 sandbox and into the real 64 bit registry.

C:WindowsSysNative
eg.exe QUERY "HKLMSOFTWAREMicrosoftMicrosoft SQL ServerInstance NamesSQL"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...