[Samba] Remote Windows registry read access from Linux?

RRuegner robert at ruegner.org
Thu Feb 26 13:19:29 GMT 2004


Hi,
you can merge reg setting at netlogon
with regedit /s regfile
for example
a rollout for tightvnc remote control

REM at echo off
REM default login script robowarp at gmx.de

REM install printers
rundll32 printui.dll,PrintUIEntry /dn /n "\\smbpdc\bjc2000" /q
rundll32 printui.dll,PrintUIEntry /in /n "\\smbpdc\bjc2000"
rundll32 printui.dll,PrintUIEntry /dn /n "\\smbpdc\pdfwriter" /q
rundll32 printui.dll,PrintUIEntry /in /n "\\smbpdc\pdfwriter"

REM sync time
net time \\smbpdc /set /yes

REM general shares
net use v: \\smbpdc\pdf
net use w: \\smbpdc\files1
net use x: \\smbpdc\files2
net use y: \\smbpdc\files3

REM -------------------------------------INSTALLER--------------------------
-----------------------
REM This will install the VNC files from Y:\install to C:\rcontrol
REM we use this path to hide from users and do not conflict with an exist
tightvnc setup
REM If WinVNC.exe is not there we will assume that the system needs all the
files
IF NOT EXIST C:\rcontrol\WinVNC.EXE goto TVNCINSTALL
REM if winvnc.exe exist in our setup dir make sure that our reg settings
gets merged
IF EXIST C:\rcontrol\WinVNC.EXE goto TVNCREGINSTALL
exit

REM This section copies the VNC files, installs the VNC  service and runs
REM TVNC the first time

:TVNCINSTALL
Rem copy the needed files to a tmp dir on the client psexec wants to start
from there
xcopy y:\install \\%COMPUTERNAME%\c$\tmp\ /y
REM next tvnc will installed silent without any entry in the program folders
psexec \\%COMPUTERNAME% c:\tmp\tightvnc-1.2.9-setup.exe /SP- /VERYSILENT
/DIR="c:\rcontrol" /NOICONS
REM our reg file gets merged
psexec \\%COMPUTERNAME% c:\tmp\regedit /s c:\tmp\tightvnc.reg
REM next line is to kill another vnc server which may run
psexec \\%COMPUTERNAME% c:\rcontrol\winvnc.exe -remove
REM now the vnc service is privided
psexec \\%COMPUTERNAME% c:\rcontrol\winvnc.exe -install
REM the service get started
psservice \\%COMPUTERNAME% start winvnc
REM we delete all files in the tmp dir
del \\%COMPUTERNAME%\c$\tmp /q

REM make sure our reg gets merged anyway
:TVNCREGINSTALL
psservice \\%COMPUTERNAME% stop winvnc
regedit /s tightvnc.reg
psservice \\%COMPUTERNAME% start winvnc





----- Original Message ----- 
From: "flinchlock" <fst6x7v02 at sneakemail.com>
To: "samba list" <samba at lists.samba.org>
Sent: Thursday, February 26, 2004 1:53 PM
Subject: Re: [Samba] Remote Windows registry read access from Linux?


> > But I'm still in the market for a remote repository access
> > solution...
>
> I can't help you with a *nix solution (how about perl for reg
> access?), but I can point you to a Windows program.
>
> http://www.kixtart.org
>
> This TINY program (241,664 bytes KIX32.EXE) is simply very easy to
> use... just simple code in a text type file.
>
> It can be copied to the NETLOGON share, and then the program can do
> whatever you need.
>
> For example, before I retired 1999, I had developed my own home
> grown SMS like system for a company where I worked.  I managed
> 6000+ workstations/servers in 125 cities in 5 states.
>
> I had 2000+ lines of code that would query *ALL* machines in my
> domain, and put the results in a ".csv" file.  This file can then
> be imported into your favorite database.
>
> I don't have access to any of the code I wrote, but the "language"
> is mostly just a super batch type language.
>
> For example...
> ------------------------------------------------
> ;  DEMO.KIX
> ;
> ;  KiXtart demonstration script of registry functions.
> ;
> ;  24-Aug-1995
> ;
> ;  Note :  This code sample is provided for demonstration purposes
> only.
> ;          Microsoft makes no warranty, either express or implied,
> ;          as to its usability in any given situation.
> ;
>
> cls                                   ; clear the screen
> color w+/n
>
> ? "START"
>
> :start
> if existkey( "HKEY_CURRENT_USER\KiX32" ) <> "0"
>    if addkey( "HKEY_CURRENT_USER\KiX32" ) = 0
>       color g+/n
>       ? "OK, added KiX32 key."
>       if addkey( "HKEY_CURRENT_USER\KiX32\one" ) = 0 AND
>          addkey( "HKEY_CURRENT_USER\KiX32\two" ) = 0 AND
>          addkey( "HKEY_CURRENT_USER\KiX32\three"
>          ? "...and some subkeys..."
>          if writevalue( "HKEY_CURRENT_USER\KiX32\one" , "value1" ,
> "Text" , "REG_SZ" ) AND
>             writevalue( "HKEY_CURRENT_USER\KiX32\one" , "value2" ,
> "line1|line2(with a || in it)|line3|" , "REG_MULTI_SZ" ) AND
>             writevalue( "HKEY_CURRENT_USER\KiX32\one" , "value3" ,
> "0a12defa0b" , "REG_BINARY" ) AND
>             writevalue( "HKEY_CURRENT_USER\KiX32\one" , "value4" ,
> "123456789" , "REG_DWORD" )
>             ? "...and now even some values..."
>             ? "Please check the result with REGEDT32."
>             ? ? "End of demo : press <anykey> to delete the key
> again."
>             get $x
>             $result = deltree("HKEY_CURRENT_USER\KiX32")
>             goto end
>          else
>             ? "Hmm, WriteValue failed with returncode : " + @error
>          endif
>       else
>          ? "Hmm, AddKey failed with returncode : " + @error
>       endif
>    else
>       ? "Hmm, AddKey failed with returncode : " + @error
>       end
>    endif
> else
>    ? "Huh ?. Key already exists ?!?."
>    ? "Do you want me to delete it  (Y/N) ?."
>
>    :loop
>    GET $Input
>    if $Input = "Y"
>       if Deltree( "HKEY_CURRENT_USER\KiX32" )= 0
>          ? "OK, Key deleted......"
>          goto start
>       else
>          ? "Hmmm, somehow the delete failed : " + $RC
>          exit
>       endif
>    else
>       if $Input = "N"
>          ? "OK, then I'll just quit."
>          goto end
>       else
>          goto loop     ; wrong key, try again
>       endif
>    endif
> endif
>
> :end
>
> color w+/n
>
> ? ? "END"
>
> color w/n
> ------------------------------------
>
> HTH
>
> Mike
>
> -- 
> SuSE 9.0 Pro (2.4.21-192-default) with samba-2.2.8a-107
> -- 
> To unsubscribe from this list go to the following URL and read the
> instructions:  http://lists.samba.org/mailman/listinfo/samba
>



More information about the samba mailing list