Slipstreaming and adding printers

T

Tom Hagen Jr

I'm creating a slipstream image for my Windows 2000 Pro computers to use both on a server running RIS and a bootable DVD. The problem I'm having now is I'm trying to have the Windows 2000 Pro workstations add a printer after the install. I have the following in the winnt.sif file for autologon, but when it does the autologon it goes for the local admin not the domain account that I use to add the workstation to the OU, thereby not allowing the printer to be added. (Areas have been changed so that password and accounts are not exposed)

[GuiUnattended]
AdminPassword = workstaion.admin.password
AutoLogon = Yes
AutoLogonCount = 1
OEMSkipRegional = 1
OEMSkipWelcome = 1
TimeZone = 20

[Identification]
DomainAdmin = Workstation.Install.account
DomainAdminPassword = workstation.password
JoinDomain = CompanyDomain
; MachineObjectOU="OU=MyOU,OU=MyParentOU,DC=mydom,DC=MyCompany,DC=com" ;Read KB302158, KB226315

[GuiRunOnce]
Command0 = "rundll32 printui.dll,PrintUIEntry /in /n \\server.name\\HP LaserJet 5Si"
Command1 = "Robocopy D:\I386 C:\I386 /E /R:3 /A-:RA"
Command2 = "C:\I386\Software Apps\Media Player\wmp.cmd"
Command3 = "regedit.exe /s C:\I386\Registry\wmp.reg"
Command4 = "regedit.exe /s C:\I386\Registry\srcpath.reg"
Command5 = "regedit.exe /s C:\I386\Registry\explorer.reg"
Command6 = "C:\I386\Software Apps\Install.bat"

Thanks for any help
 
S

Steven Liu

Hi Tom,

; MachineObjectOU="OU=MyOU,OU=MyParentOU,DC=mydom,DC=MyCompany,DC=com"
; Read KB302158, KB226315

I have checked the 302158. It confirms it's a bug. The problem has already
been fixed in the Windows 2000 SP3. You can slipstream the Windows 2000 SP3
to the Windows 2000 installation files. Then, the MachineObjectOU will be
executed well.

You can run the "<service pack 3 path>\update\update -s:<path_to_image>"
command to slipstream the Service Pack to the installation files.

258868 Slipstream Switch for Windows 2000 Service Pack Update.exe Does Not
Work
http://support.microsoft.com/?id=258868

The computer is joined to the CompanyDomain. Therefore, the computer will
logon to the local computer with the local admin. Then, it can't install
the printer.

This is by design. When you set the "AutoLogon = Yes", the computer will
logon locally automatically with the AdminPassword applied here.

It's better to reconfigure the RIS image to include the printer and these
configurations made by command 2-6. This is better and stable.

If you like to work with this image, you can try to modify the command 0-6
with runas command and run the command 0-6 as the DomainAdmin and
DomainAdminPassword.

If this still does not work, you can create a batch file as the logon
script for each user. Remove the AutoLogon from the winnt.sif.

For example:

================================================

Check a specific key in the registry. If its value is 1, exit.

If the value is 0 or the key not found, do the following commands.

Command0 = "rundll32 printui.dll,PrintUIEntry /in /n \\server.name\\HP
LaserJet 5Si"
Command1 = "Robocopy D:\I386 C:\I386 /E /R:3 /A-:RA"
Command2 = "C:\I386\Software Apps\Media Player\wmp.cmd"
Command3 = "regedit.exe /s C:\I386\Registry\wmp.reg"
Command4 = "regedit.exe /s C:\I386\Registry\srcpath.reg"
Command5 = "regedit.exe /s C:\I386\Registry\explorer.reg"
Command6 = "C:\I386\Software Apps\Install.bat"

Create the specific key in the registry and set the value to 1.

REM if the login script has already been done, commands 0-6 will not been
executed again.

================================================

Note 1: I only give you the direction here. You should complete the batch
file.

Note 2: the batch file may have problem. The "Command1 = "Robocopy D:\I386
C:\I386 /E /R:3 /A-:RA"" may need some times to finish. The rest commands
will need the files in c:\i386. These commands are executed one by one.
When the commad 1 starts, the system will execute command2 without waiting
for the command1 finished. So, the rest commands may fail for the file not
found or other reason. I think you can change the path to let the client to
load the files from the server directly. Or, add the enough pause after the
command1.

When the user logon to the computer, it will load the login script and
execute the command 0-6 if necessary.

Thanks for using Microsoft News Group!

Sincerely,

Steven Liu

Microsoft Online Partner Support

MCSE 2000

Get Secure! - www.microsoft.com/security

This posting is provided "as is" with no warranties and confers no rights.
 
T

Tom Hagen Jr

Steven,
I was affraid of that, I'm using SP4 and have done the update for the slip stream as suggested. What is the command perameter
that I need to use to pass on the password have not been able to find it in TechNet.
Curently I'm using: Command 0 = "runas /user:[email protected] 'rundll32 printui.dll,PrintUIEntry /in /n
\\server\HP.LaserJet.5Si'"

About the waiting period, actually with the order I've been doing the commands I have not had any problems. It does seem to wait
until the command is done before moving onto the next one.
 
T

Tom Hagen Jr

I've been trying to use the su.exe (version 5.0.2128.1) using the following command line:
echo workstaion.password |su workstation.install.account "rundll32 printui.dll,PrintUIEntry /in /n \\server\\HP.LaserJet.5Si"
domain.company.com

I get the following error:
PrepareEnvironmentBlock error! (rc=203)
The system could not find the encironment
option that was entered.
CreateProcess error! (rc=1326)
Logon failure: unknown user name or bad password.

Of course when I run the following and have to manually type in the password it works:
runas /user:[email protected] "rundll32 printui.dll,PrintUIEntry /in /n \\server\HP.LaserJet.5Si"

Can anyone help? I need this working by Saturday morning. No pressure....
 
S

Steven Liu

Hi Tom,

Since the runas works, I think you can remove the command1.

Command0 = "\\server\share\addprn.vbs"
Command2 = "\\server\I386\Software Apps\Media Player\wmp.cmd"
Command3 = "regedit.exe /s \\server\I386\Registry\wmp.reg"
Command4 = "regedit.exe /s \\server\I386\Registry\srcpath.reg"
Command5 = "regedit.exe /s \\server\I386\Registry\explorer.reg"
Command6 = "\\server\I386\Software Apps\Install.bat"

The following is the code of the addprn.vbs

=============================

dim wshShell
set wshShell=CreateObject("Wscript.Shell")
wshShell.run("runas /user:[email protected]
"rundll32 printui.dll,PrintUIEntry /in /n \\server\HP.LaserJet.5Si"")
Wscript.Sleep 100
wshShell.AppActivate "Runas"
Wscript.Sleep 300
wshShell.SendKeys "adminpassword"
Wscript.Sleep 100
wshShell.SendKeys "~"
Wscript.Sleep 100

==============================

Wscript.Sleep is used to wait for the application loading. 100 means 100ms.
If you find it's not enough, you can enlarge it.

Reference
-----------------
SendKeys Method
http://msdn.microsoft.com/library/en-us/script56/html/wsMthSendKeys.asp?fram
e=true

Windows Script Host
http://msdn.microsoft.com/library/en-us/script56/html/wsoriWindowsScriptHost
.asp?frame=true

Thanks for using Microsoft News Group!

Sincerely,

Steven Liu

Microsoft Online Partner Support

MCSE 2000

Get Secure! - www.microsoft.com/security

This posting is provided "as is" with no warranties and confers no rights.
 
T

Tom Hagen Jr

The vbs script gets an error when it runs it looks like the SendKeys does not work it says the password is not recognizable. How
can I get the SU to work? That looks to be the path that would be easiest as it also have everything I need. I've used in the past
but that was with KixTart and logon scripts, not building a workstation.

The Command1 = = "Robocopy D:\I386 C:\I386 /E /R:3 /A-:RA" is to copy all the I386 files and folders to the local had drive and the
Command4 = "regedit.exe /s \\server\I386\Registry\srcpath.reg" puts in the registry to look for the I386 folder on the local drive
instead of a CD\DVD.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]
"SourcePath"="C:\\"
"ServicePackSourcePath"="C:\\"
 
S

Steven Liu

Hi Tom,

For the SU issue, I don't think the command line of the SU is correct.

echo workstaion.password |su workstation.install.account "rundll32
printui.dll,PrintUIEntry /in /n \\server\\HP.LaserJet.5Si"
domain.company.com

Please run the "su /?" to get the right syntax.

Also, you should granting "Impersonate a Client After Authentication"
privileges to authenticated users.

For more information, please refer to the article:

821546 Overview of the "Impersonate a Client After Authentication" and the
http://support.microsoft.com/?id=821546

You also may need to add the user to the local administrators group.

If this still does not work, you can call the PSS to get the fix of 265401.

265401 Su.exe Generates Error Code 1780 ("A Null Reference Pointer Was
Passed
http://support.microsoft.com/?id=265401

It contains the new version SU.exe.

As to the script, I have tested. The SendKeys works. Please replace the:

wshShell.AppActivate "Runas"

with the

wshShell.AppActivate "Rundll32"

Thanks for using Microsoft News Group!

Sincerely,

Steven Liu

Microsoft Online Partner Support

MCSE 2000

Get Secure! - www.microsoft.com/security

This posting is provided "as is" with no warranties and confers no rights.
 
Top