Re: Adding key by logon script

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



In microsoft.public.win2000.registry Climberpm wrote:

> 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.

.



Relevant Pages

  • Re: How can I force registry update in Windows Server 2003
    ... >environment variable using a logon script. ... >I found out that the registry key does not take effect right away in the ... >user in the same session without having to log out and log back in. ... Asssume you were trying to set user environment variable ZZZ to This is %username% ...
    (microsoft.public.windows.server.general)
  • Re: Using NetworkCredential then a Redirect to the site requiring the credientails
    ... > and password to the world at large without any protection? ... Changing the registry key is not an option. ... the setup wasn't ~really~ broadcasting your unencrypted username> and password to the world at large without any protection? ... Arguably, if you wanted to get really fancy,> you could create a C# Proxy which passed all requests and responses between> the client and the server and added the authentication information to the> headers on every transaction-- but this would get insanely complicated and> would be very fragile. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Using NetworkCredential then a Redirect to the site requiring the credientails
    ... > and password to the world at large without any protection? ... Changing the registry key is not an option. ... the setup wasn't ~really~ broadcasting your unencrypted username> and password to the world at large without any protection? ... Arguably, if you wanted to get really fancy,> you could create a C# Proxy which passed all requests and responses between> the client and the server and added the authentication information to the> headers on every transaction-- but this would get insanely complicated and> would be very fragile. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: reconnect mapped drive
    ... mapnetworkdrive option for persistent mapping, updateProfile i believe, ... the drive maps just fine using the supplied username and password. ... I could have a logon script that gets placed in startup but it would be ...
    (microsoft.public.windows.server.scripting)
  • Re: Automating set up?
    ... You can use the Default Domain Policy to assign a logon script to all domain ... Sounds like you need to use %username% if you want the folder to be named as ... > to login using the same login batch file without having to set it in the ...
    (microsoft.public.win2000.active_directory)