Reg Import Logon Script; Windows XP

0

0

I've created a two line batch that checks for the existence of a file and if it exists, imports a reg key with the correct setting values. It needs to work with Windows 7 (32 & 64-bit) as well as Windows XP 32-bit. This is being assigned as a logon script via GPO.

IF EXIST "%programfiles(x86)%\path_to_file\file.exe" REG IMPORT "path_to_reg\file.reg"
IF EXIST "%programfiles%\path_to_file\file.exe" REG IMPORT "path_to_reg\file.reg"

This works flawlessly with Windows 7. However, I am also trying to use it for clients using Windows XP and it is there that I am having difficulty. If I run the batch from the logged in user's command-line in Windows XP it works and the values are imported. It simply does not add the values when run at logon in Windows XP. I should also add that I have tried this using both regedit.exe /s and reg import.

Matt P

Posted 2013-08-12T14:56:13.863

Reputation: 1

How exactly did you assign it as a logon script? – Ƭᴇcʜιᴇ007 – 2013-08-12T16:00:28.510

via Group Policy – Matt P – 2013-08-12T16:04:07.670

That's not very exact. ;) Basically, are you sure you added it as a logon script and not a startup script? Anything reported regarding failed GP execution in the Event Logs or Rsop.msc? Also, where is the /reg file to import being kept? – Ƭᴇcʜιᴇ007 – 2013-08-12T16:08:59.670

I'm sorry, it is assigned as a logonscript and not a startup script. No failure messages in event logs or userenv debug logs. The reg file to be imported is kept in shared directory along side the script. And just to reiterate, it works flawlessly in Win7. Win XP seems to either some of the reg values or does not apply them at all. – Matt P – 2013-08-12T16:19:21.587

Have you confirmed if the script is running at all? You need to determine if the script is failing to run, or if the reg import itself is failing. To me, it seems more the like the script just isn't running at all. Does RSOP or GPResult confirm the policy/script is assigned as expected? – Ƭᴇcʜιᴇ007 – 2013-08-12T16:21:34.590

RSOP.msc confirms it is being correctly applied. Last executed time matches last logon. – Matt P – 2013-08-12T16:27:00.357

Going through with a fine-toothed comb, it appears that the script is applying the reg but not all of the values are taking effect. In particular, the last value in the reg. Is it possible that this is happening because the key does not exist before the value is set via the reg import? – Matt P – 2013-08-12T18:13:13.223

Answers

0

Going through with a fine-toothed comb, it appears that the script is applying the reg but not all of the values are taking effect.

Settings applied to the user's registry often won't be applied until the next logon. So you logon once and the script changes the registry; then the next time you log on those settings (added at last logon) are actually applied to the user.

We often have to tell users to "reboot twice" after we make GPO/registry changes. Once to change once to apply. :)

Ƭᴇcʜιᴇ007

Posted 2013-08-12T14:56:13.863

Reputation: 103 763

A good thought but the issue still occurs no matter how many times you reboot/relog. – Matt P – 2013-08-12T20:24:44.993