[THIN] Re: wtsuprn.inf importing to CMC

  • From: "jc lamb" <jc_lamb@xxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Wed, 12 Nov 2003 14:56:47 -0800

Ron

if you ever get to Vancouver BC, Canada
I owe you a very large steak dinner!

thanks sire!

Jeff
  ----- Original Message ----- 
  From: Ron Oglesby 
  To: thin@xxxxxxxxxxxxx 
  Sent: Wednesday, November 12, 2003 2:25 PM
  Subject: [THIN] Re: wtsuprn.inf importing to CMC


  That thing works terribly. (just my opinion, before some at Citrix calls my 
boss). Anyway.



  We have a script for that. The contents of which are below. Remove the "  
marks (quote marks) from your existing inf so that you just have a file that 
has entries that look like so



  HP LaserJet 4/4M=HP LaserJet 4

  HP LaserJet 4P/4MP=HP LaserJet 4P

  HP LaserJet 4 Plus/4M Plus=HP LaserJet 4 Plus

  HP LaserJet 4Si/4Si MX=HP LaserJet 4Si

  HP LaserJet 4V/4MV=HP LaserJet 4V



  Nothing else just a bunch of entries like that without quotes in a text file. 
Then run this dog with the txt file name as a parameter. It basically adds all 
your entries into the CMC and logs out to a text file on the c: drive of the 
Citrix server it was executed from. YOU MUST have read write access to the CMC 
atleast the printer node.





  <package>

      <job id="Print Driver Mappings">



          <comment>



          File:           AddPMap.wsf

          Description:    Adds Print Driver Mappings to the MetaFrame farm Data 
Store.

          Requirements:   WSH 5.5 or higher.

          

          </comment>

          <runtime>

              <description>

                 Adds Print Driver Mappings to the MetaFrame farm Data Store. 

              </description>

              <example>

                  CScript //nologo AddPMap.wsf InputFile

                                      InputFile must be in the format 
ClientDriver=ServerDriver

                                      with no spaces around the equals sign

              </example>

    

          </runtime>



          <reference object="MetaFrameCOM.MetaFrameFarm"/>

          <script language="VBScript">

              Dim fso, f, ts, objTextStream, LogFileName, Args, InputFileName

                  Dim eqCount, theFarm, theMap, sDriver, sPlatform, cDriver



              '*****************************************************

              'Define Variables

              '*****************************************************



                          set fso = CreateObject("Scripting.FileSystemObject")

                          sPlatform = "1"              'for all Windows 2000 
drivers

                          LogFileName = "c: \AddPMap.txt"



              '*****************************************************

              'Parse the command line

              '*****************************************************



                          Set Args = Wscript.Arguments

                          If Not Args.Count = 1 Then

                                      Wscript.Echo "Usage: AddPMap.wsf 
InputFile"

                                      Wscript.Quit

                          End If



          '*****************************************************         

              'Verify Input File

          '*****************************************************         



                          InputFileName = Args(0)

                          If Not fso.FileExists(InputFileName) Then

                                      Wscript.Echo "The input file is not 
found."

                                      Wscript.Echo "Usage: AddPMap.wsf 
Inputfile"

                                      Wscript.Quit

                          End If



              '*****************************************************

              'create the log file if it doesn't exist

              '*****************************************************



                          If Not fso.FileExists(LogFileName) Then

                                      fso.CreateTextFile(LogFileName)

                          End If

                          Set f = fso.GetFile(LogFileName)

                          Set ts = f.OpenAsTextStream(8, -2)

                          ts.WriteLine

                          ts.WriteLine(NOW)

                          ts.WriteLine("Client Driver=Server Driver, 
Success/Failure")

                          ts.close

                            

          '*****************************************************         

              ' Create MetaFrame Farm Object

              '*****************************************************



                          Set theFarm = 
CreateObject("MetaFrameCOM.MetaFrameFarm")

                          if Err.Number <> 0 Then

                                      WScript.Echo "Can't create MetaFrameFarm 
object"

                                      WScript.Echo "(" & Err.Number & ") " & 
Err.Description

                                      WScript.Quit Err.Number

                          End if



          '*****************************************************         

              ' Initialize the farm

              '*****************************************************            
'



                          theFarm.Initialize(MetaFrameWinFarmObject)

                          if Err.Number <> 0 Then

                                      WScript.Echo "Can't  Initialize 
MetaFrameFarm object"

                                      WScript.Echo "(" & Err.Number & ") " & 
Err.Description

                                      WScript.Quit Err.Number

                          End if



          '*****************************************************         

              ' Check Citrix Admin Credentials

              '*****************************************************



                          if theFarm.WinFarmObject.IsCitrixAdministrator = 0 
then

                                      WScript.Echo "You must be a Citrix admin 
to run this script" 

                                      WScript.Quit 0

                          End If



              '*****************************************************

              ' Create PrintDriverMappings object

              '*****************************************************



                          set theMap = 
CreateObject("MetaFrameCOM.MetaFramePrinterDriverMapping")

                          if Err.Number <> 0 Then

                                      WScript.Echo "Can't create 
PrintDriverMapping object"

                                      Wscript.Echo "(" & Err.Number & ") " & 
Err.Description

                                      Wscript.Quit Err.Number

                          End If



          '*****************************************************         

              ' Input and add the driver mapping

              '*****************************************************            
'



                          Set objTextStream = fso.OpenTextFile(InputFileName, 1)

                          Do Until objTextStream.AtEndOfStream

                                      Mapping = objTextStream.ReadLine

                                      eqCount = InStr(Mapping, "=")

                                      cDriver = Left(Mapping, (eqCount-1))

                                      sDriver = Right(Mapping, 
(Len(Mapping)-eqCount))

                                      theMap.ServerDriverName = sDriver

                                      theMap.ServerDriverPlatform = sPlatform

                                      theMap.ClientDriverName = cDriver

                                      theMap.Save

  '                                    wscript.echo cDriver & "=" & sDriver

                                      If Not Err.Number = 0 then



                                                  
'*****************************************************

                                                  'write failure into log file

                                                  
'*****************************************************



                                                  Set f = 
fso.GetFile(LogFileName)

                                                  Set ts = 
f.OpenAsTextStream(8, -2)

                                                  ts.WriteLine(cDriver & "=" & 
sDriver &      "    Driver Mapping Addition Failed ******* ")

                                                  ts.close



                                      Else

                                                  
'*****************************************************

                                                  'write success into log file

                                                  
'*****************************************************



                                                  Set f = 
fso.GetFile(LogFileName)

                                                  Set ts = 
f.OpenAsTextStream(8, -2)

                                                  ts.WriteLine(cDriver & "=" & 
sDriver & "    Driver Mapping Addition Successful")

                                                  ts.close



                                      end if 



                          Loop 'objTextStream

                          objTextStream.Close



              '*****************************************************

              'End the Script

              '*****************************************************



                          WScript.Echo "Scipt Complete, Log file written to: " 
& LogFileName 

         

          </script>

      </job>

  </package>













  Ron Oglesby

  Senior Technical Architect



  RapidApp

  Office 312.372.7188

  Mobile 815.325.7618

  email roglesby@xxxxxxxxxxxx



  -----Original Message-----
  From: jc lamb [mailto:jc_lamb@xxxxxxxxxxx] 
  Sent: Wednesday, November 12, 2003 3:59 PM
  To: thin@xxxxxxxxxxxxx
  Subject: [THIN] wtsuprn.inf importing to CMC



  hey kids



  I am having an issue where the wtsuprn.inf is not being "picked up" in the 
CMC.



  I found a citrix article that says to use qprinter to import the inf file, 
but when I run the command (qprinter /imprmapping wtsuprn.inf) I get a 
"successful message, but when I look at the mappings in cmc they have not 
changed.



  is there something else I need to do to complete the import?

  I.e. restart IMA server or spooler service?



  thanks!

  Jeff

Other related posts: