none
Vbscript RegRead function not behaving consistently and/or returning correct values when they exist in the registry RRS feed

  • Question

  • Hello.

    I seem to be having a problem using the RegRead function within vbscript to return a simple value from the registry. When I run it on my workstation (windows 7 x64 sp1), it seems to miss certain registry values that are indeed there (specifically, I am looking for instances of "Adobe" in the displayName value of HKLM\Software\wow6432node\microsoft\windows\uninstall). However, when I run on a test VM, it returns the values fine. I am hoping someone might be able to explain this inconsistency and why it is happening.

    The code is very simple:

    On Error Resume Next
    
    if wscript.arguments.count < 1 then
    	wscript.echo "usage: regread.vbs <hostname> <appname>"
    	wscript.quit
    end if
    
    AppName = wscript.arguments(1)
    strComputer = wscript.arguments(0)
    const HKEY_LOCAL_MACHINE = &H80000002
    
    Set WshShell = WScript.CreateObject("WScript.Shell")
    
    Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!//"& strComputer & "/root/default:StdRegProv")
    strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
    objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
    
    For Each subkey In arrSubKeys
    	'wscript.echo subkey
        	InstalledAppName = ""
        	InstalledAppName = WshShell.RegRead("HKLM\" & strKeyPath & "\" & subkey & "\DisplayName")
    		wscript.echo vbtab&"DisplayName: "&InstalledAppName
    
    	if instr(InstalledAppName,AppName) > 0 then		
    		wscript.echo vbcrlf&"found"&vbcrlf
    	end if
    Next
    

    When I run "cscript regread.vbs remoteHost Adobe" on my local machine, it does not "find" any instance of Adobe within the registry of machine "remoteHost". However, when I run it from a test VM, it does find the existing instances of Adobe within the DisplayName value of the uninstall key of the registry, here is the output from both, first the non-working one, then the working test VM.

    Non-working:

    Microsoft (R) Windows Script Host Version 5.8
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: GPL Ghostscript 8.60
    	DisplayName: GPL Ghostscript Fonts
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft Office Professional Plus 2010
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft ASP.NET 2.0 AJAX Extensions 1.0
    	DisplayName: 
    	DisplayName: Sybase PowerBuilder 12.0 Standard Runtime
    	DisplayName: MSXML 4.0 SP3 Parser
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: MSXML 4.0 SP3 Parser (KB2758694)
    	DisplayName: Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.4148
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft Windows Journal Viewer
    	DisplayName: Java Auto Updater
    	DisplayName: VBA (2627.01)
    	DisplayName: Microsoft Visual C++ 2005 Redistributable
    	DisplayName: 
    	DisplayName: Apple Software Update
    	DisplayName: SQL Anywhere 9 for Windows x64
    	DisplayName: Microsoft Office Professional Plus 2010
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Update for Microsoft Office 2010 (KB2553267) 32-Bit Edition
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Update for Microsoft Office 2010 (KB2760631) 32-Bit Edition
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Update for Microsoft Office 2010 (KB2494150)
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{90140000-0011-0000-0000-0000000FF1CE}_Office14.PROPLUS_{9569DE03-1425-4D12-96EB-44D852AF759A}\DisplayName
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Update for Microsoft Office 2010 (KB2553065)
    	DisplayName: 
    	DisplayName: Security Update for Microsoft Office 2010 (KB2598243) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2825640) 32-Bit Edition
    	DisplayName: 
    	DisplayName: Update for Microsoft Outlook Social Connector 2010 (KB2553406) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Office 2010 (KB2553371) 32-Bit Edition
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Security Update for Microsoft Office 2010 (KB2589320) 32-Bit Edition
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Update for Microsoft Office 2010 (KB2596964) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2566458)
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft Office Access MUI (English) 2010
    	DisplayName: 
    	DisplayName: Microsoft Office Excel MUI (English) 2010
    	DisplayName: 
    	DisplayName: Microsoft Office PowerPoint MUI (English) 2010
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft Office Publisher MUI (English) 2010
    	DisplayName: 
    	DisplayName: Microsoft Office Outlook MUI (English) 2010
    	DisplayName: Update for Microsoft Outlook Social Connector 2010 (KB2553406) 32-Bit Edition
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft Office Word MUI (English) 2010
    	DisplayName: 
    	DisplayName: Microsoft Office Proof (English) 2010
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft Office Proof (French) 2010
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft Office Proof (Spanish) 2010
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft Office Proofing (English) 2010
    	DisplayName: 
    	DisplayName: Microsoft Office InfoPath MUI (English) 2010
    	DisplayName: 
    	DisplayName: Microsoft Office Shared MUI (English) 2010
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Update for Microsoft Office 2010 (KB2553310) 32-Bit Edition
    	DisplayName: Microsoft Office OneNote MUI (English) 2010
    	DisplayName: 
    	DisplayName: Update for Microsoft OneNote 2010 (KB2553290) 32-Bit Edition
    	DisplayName: Microsoft Office Groove MUI (English) 2010
    	DisplayName: 
    	DisplayName: Microsoft Office Shared Setup Metadata MUI (English) 2010
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft Office Access Setup Metadata MUI (English) 2010
    	DisplayName: 
    	DisplayName: Microsoft Office Visio Viewer 2003 (English)
    	DisplayName: Cardiff TeleForm
    	DisplayName: 
    	DisplayName: 
    	DisplayName: CodeMax Runtime Installer
    	DisplayName: Microsoft .NET Framework 1.1
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft XML Parser
    	DisplayName: 
    	DisplayName: Microsoft Visual C++ 2010  x86 Redistributable - 10.0.40219
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 

    Working:

    Microsoft (R) Windows Script Host Version 5.8
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: DYMO Label v.8
    	DisplayName: 
    	DisplayName: GPL Ghostscript 8.60
    	DisplayName: GPL Ghostscript Fonts
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft Office Professional Plus 2010
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Microsoft ASP.NET 2.0 AJAX Extensions 1.0
    	DisplayName: Adobe Flash Player 11 Plugin
    
    found
    
    	DisplayName: Sybase PowerBuilder 12.0 Standard Runtime
    	DisplayName: MSXML 4.0 SP3 Parser
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: MSXML 4.0 SP3 Parser (KB2758694)
    	DisplayName: Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.4148
    	DisplayName: Cisco WebEx Meeting Center for Internet Explorer
    	DisplayName: Configuration Manager Client
    	DisplayName: Java 7 Update 51
    	DisplayName: Citrix Online Launcher
    	DisplayName: MSXML 4.0 SP3 Parser (KB2721691)
    	DisplayName: Microsoft Windows Journal Viewer
    	DisplayName: Java Auto Updater
    	DisplayName: VBA (2627.01)
    	DisplayName: Microsoft Visual C++ 2005 Redistributable
    	DisplayName: Microsoft Visual C++ 2005 Redistributable
    	DisplayName: Apple Software Update
    	DisplayName: SQL Anywhere 9 for Windows x64
    	DisplayName: Microsoft Office Professional Plus 2010
    	DisplayName: Update for Microsoft Filter Pack 2.0 (KB2810071) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Office 2010 (KB2826035) 32-Bit Edition
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Update for Microsoft Office 2010 (KB2553267) 32-Bit Edition
    	DisplayName: Update for Microsoft PowerPoint 2010 (KB2553145) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2589375) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Office 2010 (KB2687276) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2760631) 32-Bit Edition
    	DisplayName: Update for Microsoft OneNote 2010 (KB2810072) 32-Bit Edition
    	DisplayName: Security Update for Microsoft InfoPath 2010 (KB2687422) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2494150)
    	DisplayName: Security Update for Microsoft Office 2010 (KB2687423) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Office 2010 (KB2597986) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2794737) 32-Bit Edition
    	DisplayName: Update for Microsoft SharePoint Workspace 2010 (KB2589371) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Publisher 2010 (KB2553147) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Office 2010 (KB2850016) 32-Bit Edition
    	DisplayName: Definition Update for Microsoft Office 2010 (KB982726) 32-Bit Edition
    	DisplayName: Security Update for Microsoft InfoPath 2010 (KB2760406) 32-Bit Edition
    	DisplayName: Update for Microsoft Visio Viewer 2010 (KB2810066) 32-Bit Edition
    	DisplayName: HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{90140000-0011-0000-0000-0000000FF1CE}_Office14.PROPLUS_{9569DE03-1425-4D12-96EB-44D852AF759A}\DisplayName
    	DisplayName: Update for Microsoft Office 2010 (KB2767886) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2597087) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Office 2010 (KB2687510) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2553065)
    	DisplayName: Update for Microsoft Access 2010 (KB2553446) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Office 2010 (KB2598243) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2825640) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Visio 2010 (KB2810068) 32-Bit Edition
    	DisplayName: Update for Microsoft Outlook Social Connector 2010 (KB2553406) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Office 2010 (KB2553371) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2826026) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2589298) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Excel 2010 (KB2826033) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Office 2010 (KB2589320) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Word 2010 (KB2863902) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Office 2010 (KB2826023) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2760598) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2596964) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2566458)
    	DisplayName: Update for Microsoft Office 2010 (KB2589352) 32-Bit Edition
    	DisplayName: Security Update for Microsoft Outlook 2010 (KB2837597) 32-Bit Edition
    	DisplayName: Microsoft Office Access MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office Excel MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office PowerPoint MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Update for Microsoft PowerPoint 2010 (KB2553145) 32-Bit Edition
    	DisplayName: Microsoft Office Publisher MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office Outlook MUI (English) 2010
    	DisplayName: Update for Microsoft Outlook Social Connector 2010 (KB2553406) 32-Bit Edition
    	DisplayName: Update for Microsoft Outlook 2010 (KB2687623) 32-Bit Edition
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office Word MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office Proof (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Update for Microsoft Office 2010 (KB2850079) 32-Bit Edition
    	DisplayName: Microsoft Office Proof (French) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Update for Microsoft Office 2010 (KB2850079) 32-Bit Edition
    	DisplayName: Microsoft Office Proof (Spanish) 2010
    	DisplayName: Update for Microsoft Office 2010 (KB2850079) 32-Bit Edition
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Update for Microsoft Filter Pack 2.0 (KB2810071) 32-Bit Edition
    	DisplayName: Update for Microsoft OneNote 2010 (KB2810072) 32-Bit Edition
    	DisplayName: Update for Microsoft SharePoint Workspace 2010 (KB2589371) 32-Bit Edition
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Update for Microsoft Office 2010 (KB2760598) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2589352) 32-Bit Edition
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office Proofing (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office InfoPath MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office Shared MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Security Update for Microsoft Office 2010 (KB2553284) 32-Bit Edition
    	DisplayName: Update for Microsoft Office 2010 (KB2553310) 32-Bit Edition
    	DisplayName: Microsoft Office OneNote MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Update for Microsoft OneNote 2010 (KB2553290) 32-Bit Edition
    	DisplayName: Microsoft Office Groove MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office Shared Setup Metadata MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office Access Setup Metadata MUI (English) 2010
    	DisplayName: Microsoft Office 2010 Service Pack 1 (SP1)
    	DisplayName: Microsoft Office Visio Viewer 2003 (English)
    	DisplayName: Cardiff TeleForm
    	DisplayName: Adobe Acrobat XI Pro
    
    found
    
    	DisplayName: QuickTime
    	DisplayName: CodeMax Runtime Installer
    	DisplayName: Microsoft .NET Framework 1.1
    	DisplayName: WinZip 15.0
    	DisplayName: McAfee VirusScan Enterprise
    	DisplayName: Microsoft XML Parser
    	DisplayName: McAfee Agent
    	DisplayName: Microsoft Visual C++ 2010  x86 Redistributable - 10.0.40219
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: 
    	DisplayName: Apple Application Support
    

    Does anyone know why this might be happening? The only main difference is that the machine that the script does not work on, has visual studio 2013 installed.

    Please help

    Thursday, October 16, 2014 10:26 AM

Answers

  • I figured it out. I had to use the "getStringValue" method instead of just the RegRead. Hopefully someone in the future who encounters this will be able to use this information.

    • Marked as answer by KCSteele Thursday, October 16, 2014 6:23 PM
    Thursday, October 16, 2014 6:23 PM

All replies

  • ps the test VM is also windows x64 sp1
    Thursday, October 16, 2014 10:27 AM
  • Thursday, October 16, 2014 1:56 PM
  • If your goal is to get a list of installed 32-bit and/or 64-bit applications, you can use this:

    Windows IT Pro: Auditing 32-Bit and 64-Bit Applications with PowerShell


    -- Bill Stewart [Bill_Stewart]

    Thursday, October 16, 2014 2:31 PM
    Moderator
  • Thanks jrv, that provides a good explanation of wow64 and its relevance on the 32bit and 64bit portions of the registry. However it doesn't seem to explain the behavior I am seeing.

    Just to quickly reiterate, I have two machines from which I run this script, both instances query the same 3rd machine which I have referred to as "RemoteHost". Both of the two machines running this script are running the SAME OS (Windows 7 x64 SP1). One is a test VM. The other is a real desktop. The VM is able to fetch the "DisplayName" values correctly (as you can see above in the last output window I labeled "working").

    However, the other machine (for some reason which I cannot deduce and hence why I am asking the question), returns empty values for this "DisplayName" value when run against the SAME "RemoteHost" machine (as you can see in the first output windows I labeled "not working").

    The only difference between the VM and the real desktop is that the real desktop has the visual studio 2013 suite installed, however that may be irrelevant. I was hoping that someone else who has experienced similar, or knows why this is happening, would be able to provide me with some guidance,

    Thanks for your help however.

    Thursday, October 16, 2014 3:34 PM
  • With WMI it does.  Remotely some keys are not translated as you expect.  Choose either the 32 bit or 64 bit view.  All keys are not shared.


    ¯\_(ツ)_/¯

    Thursday, October 16, 2014 3:39 PM
  • jrv,

    What you say makes sense in respect to the article you posted. Yes, some keys are not translated as I expect. I am forcing the 32 bit view as you may have noticed in my code above:

    strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"

    This works correctly on a test VM. Why is it not working correctly on a desktop that is running the same OS and SP level. That is my question. I do not need to concern myself with the intracacies of wow64, 32bit and 64bit views in the registry or the philosophy that comes along with it. I simply need to understand why the script successfully returns the values on the VM, and on the desktop it does not. Do you know what could be causing this?

    All the "DisplayName" values in question are within the same parent (HKLM\software\wow6432node\microsoft\windows\currentversion\uninstall) so there is no reason they should be treated differently than any other values under the same branch.

    Thanks again.




    • Edited by KCSteele Thursday, October 16, 2014 4:09 PM
    Thursday, October 16, 2014 4:06 PM
  • I figured it out. I had to use the "getStringValue" method instead of just the RegRead. Hopefully someone in the future who encounters this will be able to use this information.

    • Marked as answer by KCSteele Thursday, October 16, 2014 6:23 PM
    Thursday, October 16, 2014 6:23 PM
  • I figured it out. I had to use the "getStringValue" method instead of just the RegRead. Hopefully someone in the future who encounters this will be able to use this information.

    So when you insisted that it worked on one machine and not the other you were lying.  That will never get you a good answer.  Either it worked or it didn't.  No GetStringValue no answer on ANY machine.


    ¯\_(ツ)_/¯

    Thursday, October 16, 2014 7:15 PM
  • The code you have written cannot get the values you want anyway. The Shell RegRead function cannot read keys on remote machines so, there too, you are not really following the information given in the links.

    Look at your script and figure out why you are starting with MWI and then trying to use a local shell method.It makes no sense.

    If you remove this line: "On Error Resume Next" you will see the errors and be able to understand what is happening.


    ¯\_(ツ)_/¯

    • Proposed as answer by jrv Friday, October 17, 2014 10:27 AM
    Thursday, October 16, 2014 7:19 PM
  • Hello jrv.

    I dont typically use vbscript, so I apologize for the confusion. I was not lying however. The RegRead function indeed can read keys on local machines, I saw it myself in testing, as I already mentioned. It was not working on my main desktop, hence why I posted this question. GetStringValue works on both.

    I already said I fixed it and the problem is done. I am not sure what you are trying to prove. Just move on and try and help someone else.

    ¯\_(ツ)_/¯


    • Edited by KCSteele Friday, October 17, 2014 10:17 AM
    Friday, October 17, 2014 10:16 AM
  • You claim you are trying to remotely read a key on a VM or other machine.  That is not possible with the "shell" RegRead.  It is only possible with the WMI functions which you started with then stuck in RegRead.

    Your original code could never have worked remotely so it is impossible to understand what you are saying and you have not posted your solution.


    ¯\_(ツ)_/¯

    Friday, October 17, 2014 10:27 AM
  • Well I think we can agree that it is not supported remotely. Because while it did initially work remotely, it didnt behave consistently; that is, it worked on the VM, but not my desktop. That's the whole reason I created this thread. Sorry if you are confused, but I most certainly was not lying and not trying to troll the forum or whatever it is you are insuinuating. Chill out a little bit and maybe you might get that Microsoft MVP.


    • Edited by KCSteele Friday, October 17, 2014 10:34 AM
    Friday, October 17, 2014 10:34 AM
  • Well I think we can agree that it is not supported remotely. Because while it did initially work remotely, it didnt behave consistently; that is, it worked on the VM, but not my desktop. That's the whole reason I created this thread. Sorry if you are confused, but I most certainly was not lying and not trying to troll the forum or whatever it is you are insuinuating. Chill out a little bit and maybe you might get that Microsoft MVP.


    I am trying to get you t understand why what you are saying is wrong.  You may have thought it worked but there were a number of things that make it impossible to actually work.

    You were enumerating a remote key.  You were using that key name with RegRead and it was looking up the local value.  That is why it could not find remote keys and values.  The local and remote machines will not match on all keys.

    The correct call is the "GetStringValue" of the registry provider because it is the only call that can read remote values. My point is that you were fooling yourself by thinking that it ever actually worked.  If anything it was just dumb luck that the keys would match. 

    So maybe you weren't actually lying but you were surely foolingyourself and confusing us.

    Anyway - glad you fixed it and just remember to not mix calls like you did.  Also don't use On Error Resume Next unless you plan on test every call for an error.


    ¯\_(ツ)_/¯

    Friday, October 17, 2014 10:51 AM
  • jrv,

    That makes complete sense, I realize now my mistake. Thanks.

    I figured that since the objReg was already bound to the remote WMI, that the enumeration of keys returned by enumKey would have the information needed to be read by regRead.

    Why you didnt just say that in the first place however. You gave some cryptic answer that did not help at all, then when I found the solution myself, you bashed me for using the code for which I had a problem with, which is reason I came here and created the thread. If I had caught that the WSH regRead was not bound to the remote machine, I would not have had to ask the question. You basically are trying to say that I should have already known the answer to the question which I asked? It makes no sense.

    But thanks for your help.


    • Edited by KCSteele Friday, October 17, 2014 11:15 AM
    Friday, October 17, 2014 11:09 AM
  • I was mostly posting in reaction to the huge amount of unrelated information  you posted.  I also reacted to your claim that the code works and that the registry calls were to blame.  Bill reacted much the same way.  Later I saw your mistake.

    When asking a technical question in a forum you need to pare the problem down to the minimum that is needed to illustrate the issue.  If you had done that you would have likely seen or guessed at your mistake.

    See the forum guidelines for more about the best ways to post a technical question.  I think it will help.


    ¯\_(ツ)_/¯

    Friday, October 17, 2014 11:23 AM
  • What confuses me jrv, is that if you knew that RegRead cannot be used within a remotely bound WMI call, you would have noticed right away and suggested the use of getStringValue. Only after I figured it out myself, you said I was lying and then just reiterated what I already had figured out myself. The topic clearly stated that I was using RegRead and the code is clear that I was attempting to use it within a remote context.

    I understand how to post a technical question and I think I provided adequate information given my misunderstanding. You simply did not provide an adequate answer.

    Thanks.

    Friday, October 17, 2014 11:40 AM