Jump to content

Recommended Posts

Posted

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?

Posted (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 by powdarrmonkey
  • Thanks 1
Posted

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

Posted
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.
  • Thanks 1
Posted
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 :)

  • Thanks 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...