Jump to content

Reading remote registry


Edano
 Share

Go to solution Solved by JLogan3o13,

Recommended Posts

i use this to read remote registry entries looping thru my LAN:

.

$x=RegRead("\\"&$a[0][0]&"\"&$Reg,"Port")
$y=RegRead("\\"&$a[0][0]&"\"&$Reg,"InstallDir")

.

the array is the network computer name or the ip-address, $Reg is the registry key. i tried with both, network computer name and ip-address, but the only result i can obtain is for the localmachine. all others return blank.

@error code is 1 resp. 3

1 if unable to open requested key  

3 if unable to remote connect to the registry

what else must i do to obtain results from all my computers ?

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

Do you have access rights, on the remote machine(s), to those keys?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You need to have access rights to the computer that you are connecting to remotely, if you have that, you should have read rights to the registry keys. 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

As BrewManNH suggests, it is most likely the location you're trying to grab, and a lack of rights. The example below works just fine for HIVES and keys that I have access to:

#include <Array.au3>

$Reg = "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\11.0\AdobeViewer"

Local $aArray[4][2]
    $aArray[0][0] = "JLVMXP1"
    $aArray[0][1] = "10.10.20.69"
    $aArray[1][0] = "JLVMXP2"
    $aArray[1][1] = "10.10.20.70"
    $aArray[2][0] = "JLVMXP3"
    $aArray[2][1] = "10.10.20.71"
    $aArray[3][0] = "JLVMXP4"
    $aArray[3][1] = "10.10.20.72"

$x = RegRead("\\" & $aArray[0][1] & "\" & $Reg, "EULA")

MsgBox(0, $aArray[0][0], $x)
MsgBox(0, $aArray[0][1], $x)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

ah, okay, are there locations in the registry that do not afford read rights ? i am quite free to use any section, since my script writes its own install directory in the registry, and i want to see remotely where it is installed for inter script communication.

currently i use "HKLMSOFTWAREEdano", but as said i could write it anywhere.

and the other question is, could the script itself set the read rights to its "own" keys ? (i am aware of possible implications)

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

  • Moderators
  • Solution

I would suggest you begin by opening the registry, browsing to the remote machine and the key that you're looking to target, and then looking at the permissions set on that key. There are a couple different ways to set permissions on remote registry. If you do a google search there should be a couple of MS articles near the top.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Yep. One of my first scripts was manipulating the network registry with Sends (see below). This was many many moons ago (2000/XP era), but it worked.

;Open Uninstall folder on remote machine

$input = InputBox( "Enter asset tag", "Please enter the machine ID" )
Run( "regedit.exe" )
WinWaitActive( "Registry Editor" )
Send( "{LCTRL}, {HOME}, {LEFT}" )
Send( "!f, c" )
Sleep(1000)
Send( $input & "{ENTER}" )
Send( "HK{RIGHT}SOFT{RIGHT}Micros{RIGHT}Wind{RIGHT}{DOWN}{RIGHT}Uninst{RIGHT}" )

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

i guess it was easier than today. the post xp os are so picky with admissions. (i still use xp, but some of my remotes have vista and win7, unfortunately.)

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...