Solved

Remote registry lookup program

Posted on 2003-11-19
8
547 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
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.
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 …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

15 Experts available now in Live!

Get 1:1 Help Now