• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

Registry Hack on Log in

Would it be possible to selectively change 2 registry entries on startup depending upon the user ID.

ie. if userid = x add these entries ....

This would have to be easily centrally managed as it could need configuration for a large number of users.

The environment is Windows 2000 client and server ?
0
davebarter
Asked:
davebarter
  • 4
1 Solution
 
pschwanCommented:
Edit the user profiles on the domain controller. If there are large batches, you can do it by groups.  
0
 
pfieCommented:
I would suggest to run a cmd upon startup containing the line

rundll32 setupapi,InstallHinfSection DefaultInstall 128 <path>\doit.inf

Where doit.inf contains the regkeys to be added or deleted, or whatever you want.

Refer to http://www.inner-smile.com/
for a little tool called inf-tool, creating inf files from reg files e.g. if you are not familiar with inf file structure.

For environments with large numbers of users, i would suggest to work out the idea into a tool that is run automatically upon every startup by creating a key in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Doit[<pathto>\doit.exe]

I implemented the tool to read the numbered inf files to be done from HKLM, and applying the infs from that list that havent be done before for that user and writing the lastdone inf files number to a key in HKCU.

In your case you may implement the tool to read from a list located (and maintained) on the server, if there are inf files to be done for the specific user, and applying these.

In delphi e.g. a function to apply an inffile would look like this:

function ApplyInfToCu(InfFile: String ) : Boolean;
//function ApplyInfToCu
//applies the infile given in InfFile to registry
var
  InfFilePath : string;    //pathname of the inf File
  exitcode    : integer;   //exitcode of the execute command
begin
  result := false;
  try
    Result:=WinExecute ('rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 '+InfFile,0,true,exitcode);
  except
  end;
end; //ApplyInfToCu

Well, reading the textfile (from server) into a stringlist, looking for the username and picking out the infilenames is really simple. :o)
(the username you get with GetEnvString('USERNAME') and if you design the list like an ini file, you may take advantage of the class TiniFile, that pulls you out the values to a key very easily and serves them to you in a structured list).

rgds
Petra
0
 
pfieCommented:
I guess i should have written this into an answer?

hmm.. sorry, was my first try
0
 
pfieCommented:
I guess i should have written this into an answer?

hmm.. sorry, was my first try
0
 
pfieCommented:
I guess i should have written this into an answer?

hmm.. sorry, was my first try

Petra
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now