Hi Remmie
This took me less time than expected.
The script is (very) crude but effective. Ensure all users are logged off when it is executed. The script does not set the default printer for any users who are logged on.
The script updates the default printer for all existing users on the machine, and updates the default printer for the windows .default user.
Fill the UserRoot and Data values for your system, and you are ready to go.
I've tested this with XPSP2 and would expect it to work for 2K as well. I've tested transfer to c: root and execution from there.
@echo off
If NOT "%1"=="" Goto Update
REM ** User Data ***
Set UserRoot=C:\Documents and Settings
Set KeyName=Software\Microsoft\Windows NT\CurrentVersion\Windows
Set Value=Device
Set ValueType=REG_SZ
Set Data=[Your printer data]
REM ** Internal Data***
REG ADD HKU\.Default\%Keyname% /v "%Value%" /t "%ValueType%" /d "%Data%" /f
FOR /F %%p IN ('dir /b "%UserRoot%"') DO %0 %%p
:Update
Set UserPath=%1
Set TempKey=HKU\TEMP
Echo Path = %UserRoot%\%UserPath%\NTUSER.Dat
REG LOAD "%TempKey%" "%UserRoot%\%UserPath%\NTUSER.Dat"
REG ADD "%TempKey%\%KeyName%" /v "%Value%" /t "%ValueType%" /d "%Data%" /f
REG UNLOAD "%TempKey%"
Message Edited by Xan Todd on 05-03-200705:22 PM