Lansweeper logo
Home Download Features Demo Buy now Help Support forum
 
    Most requested support articles:
  Lansweeper troubleshooting guide.
  The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
  WMI Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
  How to configure the windows firewall using group policies.
  Support:  
 support@lansweeper.com  
Skype: Lansweeper  
  Mo-Fri 9h-17h CET  
Welcome Guest Search | Active Topics | Log In | Register

Untag as favorite
Connect to remote registry tool
sticky
#1 Posted : Tuesday, March 24, 2009 8:59:41 PM

Rank: Premium user

Groups: Member, Premium Users
Posts: 31
Location: New Zealand
Hi,

I often need to connect to a remote registry using regedit to check settings etc. I couldn't figure out how to do it from the command line (if someone knows, please share!), so I wrote a quick AutoIT script to do it. Convert to .exe, copy to a suitable location and create the following custom action:

\\server\lstools$\remote_regedit.exe {computer}

Have attached the .exe to this post for others to use. The AutoIT code is below.

Code:

;
; AutoIt Version: 3.3
; Language:       English
; Platform:       Win2000/XP/Vista/2008
; Author:         Michael Ward
;
; Script Function:
;   Connects to a remote registry using regedit
;

if ($CmdLine[0] > 0) Then
    $hostname = $CmdLine[1]
Else
    MsgBox(48,"Error","No Hostname Specified",60)
    Exit(1)
EndIf

; Run Regedit
Run("regedit.exe")


; Wait for the regedit to become active
WinWaitActive("Registry Editor")

; Connect to the remote registry
Send("!f")
Send("c")
WinWaitActive("Select Computer")
Send($hostname)
Send("{ENTER}")

; Finished!
File Attachment(s):
remote_regedit.exe (285kb) downloaded 522 time(s).
taeratrin
#2 Posted : Wednesday, March 25, 2009 1:31:43 PM

Rank: Premium user

Groups: Premium Users
Posts: 214
Regedit commandline switches include :

/L:system Specify the location of the system.dat to use
/R:user Specify the location of the user.dat to use

I would imagine pointing those to the (admin share + appropriate path) on the remote computer would do the trick.
mrdaytrade
#3 Posted : Wednesday, March 25, 2009 7:49:26 PM


Rank: Premium user

Groups: Premium Users
Posts: 89
Location: Albany, NY
VERY NICE! I've been looking for a way to do this for sometime now. Thanks! Applause
Damien
#4 Posted : Monday, December 07, 2009 6:17:59 PM
Rank: Freeware user

Groups: Member
Posts: 3
Location: Maine
Is there a way to do a mass registry edit using this command?
GerardSweeney
#5 Posted : Friday, October 07, 2011 10:50:28 AM
Rank: Freeware user

Groups: Member
Posts: 1
Location: Glasgow
At the risk of showing bad form and resurrecting an old thread, I've modified this code slightly for my own use.

I've adapted this for my Altiris DS console so that I can right click on the computer in the DS console and access the registry directly.

If you don't want the options embedded, it'd be relatively simple to read an ini file with iniread($inifile, "Settings", "OnePCPerWindow, "Y")

Please don't laugh too hard at my hideous coding :)

Code:

;
; AutoIt Version: 3.3
; Language:       English
; Platform:       Win2000/XP/Vista/2008
; Author:         Michael Ward
; Modification by Gerard Sweeney, 2011
;
; Script Function:
;   Connects to a remote registry using regedit
;

; Choices here - if you don't want multiple PCs open in the one
; regedit window, we can present some choices
; OnePCPerWindow - Close Regedit first before opening the specified PC
; Prompt - Ask the user if they want to close regedit first
; Note that setting OnePCPerWindow to "N" over-rides $Prompt

$OnePCPerWindow = "N"
$Prompt = "Y"


if ($CmdLine[0] > 0) Then
    $hostname = $CmdLine[1]
Else
    MsgBox(48,"Error","No Hostname Specified",60)
    Exit(1)
EndIf

$P = "regedit.exe"
$T = "Registry Editor"



    ; Run Regedit if it isn't already running
    If ProcessExists($P) <> 0 then
        If $OnePCPerWindow = "Y" then
            If $Prompt = "Y" then
            $Q = Msgbox(35, "Regedit already open", "Regedit is already running." & @CRLF & @CRLF & "Do you want to open the registry for PC " & $HostName & " in this window?" & @CRLF & @CRLF & "Yes = Open in current window" & @CRLF & "No = Close current Regedit window first" & @CRLF & "Cancel = do not attempt to open the remote registry at all")
                Select
                Case $Q = 7
                ; No clicked
                ProcessClose($P)
                ProcessWaitClose($P,10)
                
                Case $Q = 6
                ; Yes clicked
                
                Case Else
                ; Cancel
                EXIT
                EndSelect
            Else
            ProcessClose($P)
            ProcessWaitClose($P,10)
            EndIf
        EndIf
    EndIf

    If ProcessExists($P) = 0 then
    Run($P)
    ; Wait for the regedit to become active
    WinWaitActive($T)
    EndIf
    
WinActivate($T)
WinWaitActive($T)

; Connect to the remote registry
Send("!f")
Send("c")
WinWaitActive("Select Computer")
Send($hostname)
Send("{ENTER}")

; Finished!
Users browsing this topic
Guest
Untag as favorite
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Contact: E-mail Lansweeper - Skype : Lansweeper
Copyright 2004 - 2011 © Hemoco bvba