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!