I want to apply some registry settings at startup.
I've dumped the reg files in the netlogon folder and created a bat file to call the reg files.
The bat file resides in one of the GPO under startup and is meant to call the reg files, but it doesn't.
%windir%\regedit.exe /s %logonserver%\netlogon\StartupScripts\PR2.REG
%windir%\regedit.exe /s %logonserver%\netlogon\StartupScripts\DisableLogonDialup.REG
A few days ago some members had fixed this for me to get other other reg file to work under logon.
Can I just add that if I run the bat file manually after logging in, it works. Why doesn't it just work when the PC is booted up and it's at the "Running start up scripts" stage?
Do I need to do anything different?
Because you're running this script in the machine context, not a user's, the %LOGONSERVER% variable expands to nothing. You can use the format \\domain.local\netlogon to pick a server from amongst your domain if that's what you're trying to do.
Thanks a million! That worked.
Am I right to assume that the %logonserver% variable works only on logon and that you need to incorporate the 'domain.local' if it's a startup script?
%windir%\regedit.exe /s %logonserver%\netlogon\StartupScripts\PR.REG
%windir%\regedit.exe /s \\schoolname.local\netlogon\StartupScripts\DisableLogonDialup.REG
no %logonserver% only works when a user logs on.
Because the machines are on the domain the netlogon share should be accessable from under the netbios domain name just like a DFS root so you may be able to use this \\%userdomain% depending on whether the machine accounts domain information is avalible at the time.
%LOGONSERVER% expands to the specific server the machine picked as the user logged in, in flat format (open a command prompt and say "echo %LOGONSERVER%" to see it). If you give a fully-qualified domain name, Windows picks a server from the available pool of DCs, as a rough sort of load-balancing.
Originally Posted by Chuckster
Therefore, you can use a FQDN in either sort of script, but %LOGONSERVER% in a login script only.
Edit: sorry, I started typing this before I had my break, so it took forever and you have three answers now :)