Adding key by logon script

C

Climberpm

I'm having a problem adding a registry key by logon script. Actually the
key adds OK but it just adds the wrong value.

The script loads a .reg file however it doesn't replace the %USERNAME%
variable with the actual username but instead uses USERNAME. So I end up
with a folder named "%USERNAME% and not "jdoe"

Here is the content of the .reg file, which I load from the script by the
"regedit /s loadkey.reg" command

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Creative Solutions\Practice Management]
"LocalPath"="n:\\wincsi.net\\ps\\%USERNAME%"

Any thoughts ?

Thanks

Paul
 
M

Mark V

In said:
I'm having a problem adding a registry key by logon script.
Actually the key adds OK but it just adds the wrong value.

The script loads a .reg file however it doesn't replace the
%USERNAME% variable with the actual username but instead uses
USERNAME. So I end up with a folder named "%USERNAME% and not
"jdoe"

Here is the content of the .reg file, which I load from the
script by the "regedit /s loadkey.reg" command

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Creative Solutions\Practice
Management] "LocalPath"="n:\\wincsi.net\\ps\\%USERNAME%"

Any thoughts ?

To get variables to be resolved, the value's Type must be
REG_EXPAND_SZ (Expand String). As REG_SZ the %USERNAME% is treated
literally.

Consider REG.EXE MS Tool perhaps.
 
C

Climberpm

Thanks Mark, I'll give that a try. I tried manually changing the variable
and it didn't produce the expected results with the application so I'm
waiting to hear back from them. If it doesn't work with a manual edit the
script won't doing anything even if I can find the right context/tool.

Paul




Mark V said:
In said:
I'm having a problem adding a registry key by logon script.
Actually the key adds OK but it just adds the wrong value.

The script loads a .reg file however it doesn't replace the
%USERNAME% variable with the actual username but instead uses
USERNAME. So I end up with a folder named "%USERNAME% and not
"jdoe"

Here is the content of the .reg file, which I load from the
script by the "regedit /s loadkey.reg" command

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Creative Solutions\Practice
Management] "LocalPath"="n:\\wincsi.net\\ps\\%USERNAME%"

Any thoughts ?

To get variables to be resolved, the value's Type must be
REG_EXPAND_SZ (Expand String). As REG_SZ the %USERNAME% is treated
literally.

Consider REG.EXE MS Tool perhaps.
 
M

Mark V

In said:
Thanks Mark, I'll give that a try. I tried manually changing
the variable and it didn't produce the expected results with the
application so I'm waiting to hear back from them. If it
doesn't work with a manual edit the script won't doing anything
even if I can find the right context/tool.

It seems possible that the application is reading the value
directly and was not written to use or understand REG_EZPAND_SZ
types.
? (pure guess)
Mark V said:
In said:
I'm having a problem adding a registry key by logon script.
Actually the key adds OK but it just adds the wrong value.

The script loads a .reg file however it doesn't replace the
%USERNAME% variable with the actual username but instead uses
USERNAME. So I end up with a folder named "%USERNAME% and not
"jdoe"

Here is the content of the .reg file, which I load from the
script by the "regedit /s loadkey.reg" command

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Creative Solutions\Practice
Management] "LocalPath"="n:\\wincsi.net\\ps\\%USERNAME%"

Any thoughts ?

To get variables to be resolved, the value's Type must be
REG_EXPAND_SZ (Expand String). As REG_SZ the %USERNAME% is
treated literally.

Consider REG.EXE MS Tool perhaps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top