I'm have succeeded in automatically installing printers with WPI, by using vbscript.
I also want to configure default options (Duplex feature) on some printers.
And finally, I want newly created user account to already have a preference to print duplex on those.
To do this last step, I needed to run multiple REG IMPORT commands, so I created a batchfile:
CODE
REG IMPORT "%WPIPATH%\Install\Printer Scripts\PrintersConfig.reg"
REG IMPORT "%WPIPATH%\Install\Printer Scripts\UserPrefs_HKCU.reg"
REG LOAD HKEY_USERS\Default_User "C:\Documents and Settings\Default User\ntuser.dat"
REG IMPORT "%WPIPATH%\Install\Printer Scripts\UserPrefs_Default_User.reg"
REG UNLOAD HKEY_USERS\Default_User
REG IMPORT "%WPIPATH%\Install\Printer Scripts\UserPrefs_HKCU.reg"
REG LOAD HKEY_USERS\Default_User "C:\Documents and Settings\Default User\ntuser.dat"
REG IMPORT "%WPIPATH%\Install\Printer Scripts\UserPrefs_Default_User.reg"
REG UNLOAD HKEY_USERS\Default_User
This batchfile itself is run from WPI as:
CODE
"%wpipath%\Install\Printer scripts\CustomConfig.bat"
However, the %wpipath% variable is not available in my batch file...
I solved it by calling it with wpipath as first argument:
CODE
"%wpipath%\Install\Printer scripts\CustomConfig.bat" %wpipath%
and then using %1 in my batch file:
CODE
REG IMPORT "%1\Install\Printer Scripts\PrintersConfig.reg"
REG IMPORT "%1\Install\Printer Scripts\UserPrefs_HKCU.reg"
REG LOAD HKEY_USERS\Default_User "C:\Documents and Settings\Default User\ntuser.dat"
REG IMPORT "%1\Install\Printer Scripts\UserPrefs_Default_User.reg"
REG UNLOAD HKEY_USERS\Default_User
REG IMPORT "%1\Install\Printer Scripts\UserPrefs_HKCU.reg"
REG LOAD HKEY_USERS\Default_User "C:\Documents and Settings\Default User\ntuser.dat"
REG IMPORT "%1\Install\Printer Scripts\UserPrefs_Default_User.reg"
REG UNLOAD HKEY_USERS\Default_User
This works fine but I wonder if it is the Right Way...