Solved

Remote registry lookup program

Posted on 2003-11-19
8
550 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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
 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will show, step by step, how to integrate R code into a R Sweave document
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

807 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