Solved

Remote registry lookup program

Posted on 2003-11-19
8
554 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Six Sigma Control Plans

630 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