Chuckster Posted February 25, 2009 Posted February 25, 2009 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. @echo off %windir%\regedit.exe /s %logonserver%\netlogon\StartupScripts\PR2.REG %windir%\regedit.exe /s %logonserver%\netlogon\StartupScripts\DisableLogonDialup.REG The bat file resides in one of the GPO under startup and is meant to call the reg files, but it doesn't. 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?
powdarrmonkey Posted February 25, 2009 Posted February 25, 2009 (edited) 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. Edited February 25, 2009 by powdarrmonkey 1
Chuckster Posted February 26, 2009 Author Posted February 26, 2009 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? For example... Logon @echo off %windir%\regedit.exe /s %logonserver%\netlogon\StartupScripts\PR.REG Startup @echo off %windir%\regedit.exe /s \\schoolname.local\netlogon\StartupScripts\DisableLogonDialup.REG
plexer Posted February 26, 2009 Posted February 26, 2009 no %logonserver% only works when a user logs on. Ben 1
SYNACK Posted February 26, 2009 Posted February 26, 2009 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. 1
powdarrmonkey Posted February 26, 2009 Posted February 26, 2009 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? %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. 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 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now