[THIN] Re: script for adding a print driver.

  • From: Elio.DESANTIS@xxxxxxxxxxx
  • To: thin@xxxxxxxxxxxxx
  • Date: Fri, 4 Oct 2002 17:55:34 +0200


This is not a direct answer of your question but maybe someone will be
interested in.
I had to use these scripts to allow a user to always have its mappings and
printers wherever it logged on using published applications (several MF
servers)

1ST SCRIPT : BACKUPS SOMEONE'S PRINTERS AND MAPPINGS ON HIS HOMEDRIVE
=============================================================================

Dim fso, tf
Const FileMappings = "h:\PwrMenu\mappings.txt"
Const FilePrinters = "h:\PwrMenu\printers.txt"

Set fso = CreateObject("Scripting.FileSystemObject")
Set tf = fso.CreateTextFile(FileMappings, True)
Set tf1 = fso.CreateTextFile(FilePrinters, True)

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oDrives = WshNetwork.EnumNetworkDrives
Set oPrinters = WshNetwork.EnumPrinterConnections

For i = 0 to oDrives.Count - 1 Step 2
     tf.Writeline(oDrives.Item(i))
     tf.Writeline(oDrives.Item(i+1))
Next

For i = 0 to oPrinters.Count - 1 Step 2
     tf1.Writeline(oPrinters.Item(i+1))
Next

tf.close
tf1.close


2ND SCRIPT : RESTORESS SOMEONE'S PRINTERS AND MAPPINGS FROM HIS HOMEDRIVE
=============================================================================

' Wait for profile to be loaded
WScript.Sleep 5000

Dim fso, f1, ts, s
Const ForReading = 1
Const FileMappings = "h:\PwrMenu\mappings.txt"
Const FilePrinters = "h:\PwrMenu\printers.txt"

Set fso = CreateObject("Scripting.FileSystemObject")

Set WshNetwork = CreateObject("WScript.Network")

Set ts = fso.OpenTextFile(FilePrinters, ForReading)

On Error Resume Next
Do Until ts.AtEndOfStream
     s = ts.ReadLine
     WshNetwork.AddWindowsPrinterConnection s
Loop

ts.Close

Set ts = fso.OpenTextFile(FileMappings, ForReading)

Do Until ts.AtEndOfStream
     Letter = ts.ReadLine
     Path = ts.ReadLine
     WshNetwork.MapNetworkDrive Letter, Path
Loop

ts.Close




                                                                                
                                     
                    "Ron Oglesby"                                               
                                     
                    <roglesby@rapid        To:     <thin@xxxxxxxxxxxxx>         
                                     
                    app.com>               cc:                                  
                                     
                    Sent by:               Subject:     [THIN] Re: script for 
adding a print driver.                 
                    thin-bounce@fre                                             
                                     
                    elists.org                                                  
                                     
                                                                                
                                     
                                                                                
                                     
                    04/10/2002                                                  
                                     
                    17:26                                                       
                                     
                    Please respond                                              
                                     
                    to thin                                                     
                                     
                                                                                
                                     
                                                                                
                                     





This is something like what I need. All I need is the driver. Let me see
if I can do anything with that.

Ron Oglesby
Senior Technical Architect
=20
RapidApp
Office 312.372.7188
Mobile 312.961.2380
email roglesby@xxxxxxxxxxxx
=20

-----Original Message-----
From: Evan Mann [mailto:emann@xxxxxxxxxxxx]=20
Sent: Friday, October 04, 2002 10:25 AM
To: 'thin@xxxxxxxxxxxxx'
Subject: [THIN] Re: script for adding a print driver.


I was playing around with rundll32 and printui.dll to try and automate
installation of printers but never got it to work.  Here is what I
played
with:

rundll32 printui.dll,PrintUIEntry /if /b "AdminHP on ADMINDC" /f
%windir%\inf\ntprint.inf /r "HP_0CCC41_IP" /m "HP LaserJet 4050 Series
PS"

"AdminHP on ADMINDC" is the name of the shared printer on my server and
"HP
LaserJet 4050 Series PS" is the driver it users.  I forgot where I found
all
the switches and what not.  I picked it all up off Google.

Anyone ever played with this and get it to work?


-----Original Message-----
From: Ron Oglesby [mailto:roglesby@xxxxxxxxxxxx]
Sent: Friday, October 04, 2002 11:17 AM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: script for adding a print driver.



I found this in the script repository from MS but it only works with
.NET or XP machines

Set objWMIService =3D3D GetObject("winmgmts:")
Set objDriver =3D3D objWMIService.Get("Win32_PrinterDriver")
objDriver.Name =3D3D "Apple LaserWriter 8500"
objDriver.SupportedPlatform =3D3D "Windows NT x86"
objDriver.Version =3D3D "3"
errResult =3D3D objDriver.AddPrinterDriver(objDriver)


Ron Oglesby
Senior Technical Architect
=3D20
RapidApp
Office 312.372.7188
Mobile 312.961.2380
email roglesby@xxxxxxxxxxxx
=3D20

-----Original Message-----
From: Ron Oglesby=3D20
Sent: Friday, October 04, 2002 10:03 AM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] script for adding a print driver.


Anyone using a VBS (or any other type of script) for adding a large
number of print drivers to their servers during a scripted install?  If
so can I take a peek at it?

Ron Oglesby
Senior Technical Architect
=3D3D20
RapidApp
Office 312.372.7188
Mobile 312.961.2380
email roglesby@xxxxxxxxxxxx
=3D3D20

**********************************************
This weeks sponsor 99Point9.com
99Point9 helps solve your unresolved technical
server-based questions, issues and incidents.
http://www.99point9.com
***********************************************

For Archives, to Unsubscribe, Subscribe or=3D20
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm
**********************************************
This weeks sponsor 99Point9.com
99Point9 helps solve your unresolved technical
server-based questions, issues and incidents.
http://www.99point9.com
***********************************************

For Archives, to Unsubscribe, Subscribe or=20
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm
**********************************************
This weeks sponsor 99Point9.com
99Point9 helps solve your unresolved technical
server-based questions, issues and incidents.
http://www.99point9.com
***********************************************

For Archives, to Unsubscribe, Subscribe or=20
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm
**********************************************
This weeks sponsor 99Point9.com
99Point9 helps solve your unresolved technical
server-based questions, issues and incidents.
http://www.99point9.com
***********************************************

For Archives, to Unsubscribe, Subscribe or
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm




**********************************************
This weeks sponsor 99Point9.com
99Point9 helps solve your unresolved technical
server-based questions, issues and incidents.
http://www.99point9.com
***********************************************

For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm

Other related posts: