Windows Server 2003: How to add an environment variable for a Domain user on a client platform

windows-server-2003

  • I have a sheduling engine that runs
    jobs on windows 2003 server.
  • It runs as a particular domain user DOM\mtidsql.
  • I don't have access to log on as the
    user but I have admin access.
  • I need to be able to script storing a
    password in an environment variable
    that is specific to the user
  • The user does not appear to have an
    environment on the target platform
    because HKU\SID does not exist in the registry for the user. (SID is the users domain SID) but it has a profile C:\Documents And Settings\mtidsql
  • HKU\SID does not exist
  • I cant add HKU\SID\Environment\VAR_NAME ….
    using reg.exe, it returns ERROR: The
    parameter is incorrect.

Best Answer

Here's a few ideas:

  • You could mount the user's registry hive and add the value manually. Look at the "Load Hive..." functionality in REGEDIT.

  • You could logon interactively as the user and add the appropriate value using the GUI.

  • You could use "RUNAS" to open a command-prompt as the user and add the value to their registry (HKEY_CURRENT_USER\Environment) from there.