- 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.
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.
You can probably use Group Policy Preferences to set the environment variable, but I've not really tested it for a user like you describe. And like any GPO, you can put security filtering on it to ensure that only the one user can apply it. Example given below: