Solved

Remote registry lookup program

Posted on 2003-11-19
8
546 Views
Last Modified: 2010-04-17
basically i want to look at a key in the registry that holds a "PC build number" of what build we are currently on at our firm and have it display on screen.. I would prefer to have it be an exe... and ideally be able to run it to look up networked PCs build number by entering the PC name and it displaying the value of that key... The key is under HKLM\Software\Firm which stands for our firm.
0
Comment
Question by:microIT
  • 4
  • 3
8 Comments
 
LVL 5

Expert Comment

by:Insolence
ID: 9784411
Do you want someone to code this up for you and upload the source or exe, or something, if so I think you'll need to bump those points up.  =P

 - Insolence
0
 

Author Comment

by:microIT
ID: 9784488
I actually would like to do it mostly myself. i am not a hardcore programmer but i can get suggestions on what language to use and some tidbits here and there i would like to try this one. you are right, i'll bump it up.
0
 
LVL 22

Expert Comment

by:cookre
ID: 9784560
It's really pretty simple, just use RegConnectRegistry() to open a remote key, then use the normal registry calls to work with it.

0
 
LVL 22

Accepted Solution

by:
cookre earned 200 total points
ID: 9784596
Like this:
rc=RegConnectRegistry(RemoteName,HKLM,&RemoteHKLM);
rc=RegOpenKeyEx(RemoteHKLM,"Software\\MegaSysCorp",NULL,KEY_ALL_ACCESS,&TargetKey);
rc=RegQueryValueEx(TargetKey,"ValueName",NULL,NULL,strValueValue,&dwSize);

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:microIT
ID: 9784598
Mainly when i need to do something registrywise i'll use vbs.. is the function you mentioned above a function of vbs? i want to eventually tie it to a GUI or something so that you can enter the PC name and it will retrieve the key value... sorry i'm so clueless when it comes to this script, it would be very useful though because we are changing our build frequently.
0
 

Author Comment

by:microIT
ID: 9784600
the key will always be the same so that should be the easy part entering a static path.
0
 
LVL 22

Expert Comment

by:cookre
ID: 9784722
I don't know about VBS, but a VB EXE needs declarations of the API calls like this:

declare function RegConnectRegistry  _
                         lib "advapi32.dll" alias "RegConnectRegistryA"  _
                        (ByVal lpMachineName As String, ByVal hKey As Long, phkResult As Long)  _
                        As Long

declare function RegOpenKeyEx  _
                       lib "advapi32.dll" alias "RegOpenKeyExA"  _
                      (ByVal hKey As Long  _
                      ,ByVal lpSubKey As String _
                      ,ByVal ulOptions As Long _
                      ,ByVal samDesired As Long _
                      ,phkResult As Long) _
                      As Long

declare function RegQueryValueEx _
                      Lib "advapi32.dll" Alias "RegQueryValueExA" _
                     (ByVal hKey As Long _
                     ,ByVal lpValueName As String _
                     ,ByVal lpReserved As Long _
                     ,lpType As Long _
                     ,lpData As Any _
                     ,lpcbData As Long) _
                     As Long

declare function RegCloseKey Lib "advapi32.dll"  (ByVal hKey As Long) As Long




0
 
LVL 22

Expert Comment

by:cookre
ID: 9784747
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now