VMware Cloud Community
rstoker13
VMware Employee
VMware Employee

Retrieve Windows registry values using vRO

I attempted to search the forum assuming someone had asked this question already, but was unable to find anything. I apologize if this is a duplicate.

I am trying to retrieve the value of "ComputerId" under hklm\software\wow6432node\bigfix\enterpriseclient\globaloptions on a Windows 2012R2 server. As you can tell from the Key path, this is a 32bit key. I have tried WOW32, WOW64 and WOWNative without success. I have attempted the code below, even going back to the root of HKLM and recursively listing all Keys. When doing this, ONLY 2 keys are displayed. It almost seems as though it is a permissions issue but I am using a local admin account. Perhaps elevation is needed? If so, how do I elevate using Guest Operations?

var host = vm.sdkConnection;

//var regex = "~/^ComputerId$/"

var guestOperationsManager = host.guestOperationsManager;

var guestAuth = new VcNamePasswordAuthentication();

guestAuth.username = vmUsername;

guestAuth.password = vmPassword;

guestAuth.interactiveSession = true

var guestRegKeySpec = new VcGuestRegKeyNameSpec()

guestRegKeySpec.registryPath = "HKLM"

guestRegKeySpec.wowBitness = regKeyWowSpec;

var regMgr = guestOperationsManager.guestWindowsRegistryManager;

var regKeyValues = regMgr.listRegistryKeysInGuest(vm , guestAuth , guestRegKeySpec , true , null)

for each(regKeyValue in regKeyValues){

  System.debug(regKeyValue.key.keyName.registryPath)

  //System.debug(regKeyValue.name)

  }

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee

According to documentation https://pubs.vmware.com/vsphere-65/index.jsp#com.vmware.wssdk.smssdk.doc/vim.vm.guest.WindowsRegistr... , no additional privileges are required.

Could you check if using "HKEY_LOCAL_MACHINE" instead of "HKLM" makes any difference?

0 Kudos
rstoker13
VMware Employee
VMware Employee

Thank you for your reply. I have attempted using both paths. Unfortunately, it is the same result. See the run below from a moment ago.

[2017-05-25 07:15:34.075] [D] HKEY_LOCAL_MACHINE\SECURITY

[2017-05-25 07:15:34.077] [D] HKEY_LOCAL_MACHINE\SOFTWARE

[2017-05-25 07:15:34.079] [D] HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{1264760F-A5C8-4BFE-B314-D56A7B44A362}

There are hundreds more results from SYSTEM\... but only the single SOFTWARE key when using WOW32 bitness. WOW64 bitness returns an additional SOFTWARE\Microsoft\Windows\... key, but only those 2 are displayed.

0 Kudos