Mega Code Archive

 
Categories / Delphi / Examples
 

Accessing a remote registry over the network

Question: For remote administration, my tool needs to access the registry of all computers on our network. How can I do that in Delphi? Answer: The regular registry class provides a method for this: TRegistry.RegistryConnect(). Before calling RegistryConnect, you need to assign property RootKey for its registry object to HKEY_USERS or HKEY_LOCAL_MACHINE. uses Registry; var Red: TRegistry; begin Reg := TRegistry.Create; with Reg do begin RootKey := HKEY_LOCAL_MACHINE; RegistryConnect('\\peters_notebook'); OpenKeyReadOnly('Software\Microsoft'); Free; end; end;