Page 1 of 1 1
Topic Options
#196610 - 2009-11-09 04:26 PM Script is making copies of one printer
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
Does anyone one know why my script is making multiple copies of one particular printer. I have about 10 printers and all of them connect fine but just one takes a long time to conect and makes a different copy everytime i log in. My script has not changed at all. Before it was working fine.

I would appreciate any help, thanks.

Top
#196612 - 2009-11-09 04:56 PM Re: Script is making copies of one printer [Re: Gee]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Please post your cod so we can see where the error might be.

Unfortunately we do not have magic powers or a crystal ball so we can review your code without looking at it.

If you post the code then all active members can have a look and post comments/advice/suggestions or whatever they want to say about it.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#196613 - 2009-11-09 05:22 PM Re: Script is making copies of one printer [Re: Mart]
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
Here you go

The printer in bold is the one making multiple copies.

Thanks,
 Code:
"color w+/m                                               ;change background color to yellow
cls                                                     ;Clears the screen

?"Here is some information about your session:"
?
?"Current Computer Name:        @wksta."
?"The Server you logged into:   @lserver."
?"Your IP Address is:           @ipaddress0."
?
?"Please wait while your login script connects all network resources..."

IF @inwin=2
  ?"Synchronizing your clock"
  settime "*"
  IF @error=0
    ?"Your clock has been synchronized"
  ELSE
    ?
    color n/r
    "Your clock has NOT been synchronized"
    ?"You either do not have rights to change the time or"
    ?"A Time Server was unable to be located."
    color n/g
  ENDIF
ENDIF

;Changes backround logon color to black.
writevalue("hkey_users\.default\control panel\colors","background","0 0 0","REG_SZ")

?
?"Disconnecting all network drives..."
use f: /del
use g: /del
use h: /del
use i: /del
use j: /del
use k: /del
use l: /del
use m: /del
use n: /del
use o: /del
use p: /del
use q: /del
use r: /del
use s: /del
use t: /del
use v: /del
use w: /del
use x: /del
use z: /del

;*******************************************************************
;Drive Mappings
;Server Name Variables

  $fileserver = "amb"
  $techserver = "amb2"
  $newtechsrv = "amb3"
  
?
?"Connecting all network drives..."

use k: "\\$fileserver\Pub"
use l: "\\$fileserver\Sup"

;*******************************************************************

IF INGROUP("fso_Office")
  use j: "\\$fileserver\OfficeSvc"
ENDIF

IF INGROUP("fso_member_i")
  use i: "\\$fileserver\i"
ENDIF

IF INGROUP("fso_fin")
  use s: "\\AMTA\S"
  use f: "\\$fileserver\Fin"
ENDIF

IF INGROUP("fso_h")
  use x: "\\$fileserver\H"
ENDIF

IF INGROUP("fso_mark")
  use p: "\\$fileserver\Comm"
ENDIF

IF INGROUP("fso_mem")
  use p: "\\$fileserver\Mem"
ENDIF

IF INGROUP("fso_c")
  use p: "\\$fileserver\C"
ENDIF

IF INGROUP("fso_p")
  use h: "\\$fileserver\P"
ENDIF

IF INGROUP("fso_ma_space")
  use o: "\\$fileserver\Sp"
ENDIF

IF INGROUP("fso_KT")
  use t: "\\$fileserver\Kn"
ENDIF

IF INGROUP("fso_cha")
  use m: "\\$fileserver\Cha"
ENDIF

IF INGROUP("fso_ex")
  use g: "\\$fileserver\Ex"
ENDIF

IF INGROUP("fso_re")
  use r: "\\$fileserver\Re"
ENDIF

IF INGROUP("fso_t")
  use z: "\\$newtechsrv\T"
ENDIF

IF INGROUP("fso_dw")
  use w: "\\$fileserver\Da"
ENDIF

;IF INGROUP("fso_Re")
;  use x: "\\$techserver\R"
;ENDIF

;IF INGROUP("fso_Rec")
;  use x: "\\$techserver\Recordings\%USERNAME%"
;ENDIF

IF INGROUP("fso_qa")
  use q: "\\$fileserver\QA"
ENDIF

;IF INGROUP("fso_marke")
;  use q: "\\$fileserver\Creative"
;ENDIF

;IF INGROUP("fso_med")
;  use p: "\\$fileserver\MED"
;ENDIF

IF INGROUP("Non-Exempt Employees")
  copy "\\AMTADC01\NETLOGON\PunchINPunchOUT.url" "%USERPROFILE%\Start Menu\Programs\Startup\PunchINPunchOUT.url"
ENDIF

IF INGROUP("Domain Users")
  del "%USERPROFILE%\desktop\DatabaseCalender.lnk"
ENDIF

IF @wksta = "AMTAS" or @wksta = "AMTAM"
GoTo Skip
ENDIF
IF @wksta = "AM" or @wksta = "AMT"
  IF @userid = "Administrator"
    writevalue("HKEY_Current_user\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced","StartMenuAdminTools","NO","REG_SZ")
  ENDIF

  ;Installs Printers for Terminal Server Users.
  ;?"Removing Old Printers..."
  ;SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /dn /n\\amt02\X7665FIN /q"
  ;SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /dn /n\\amt02\X7665MEM /q"
ENDIF

;Installs printers for everybody.
IF @wksta <> AMT01

  ?
  ?"Installing Printers..."
  
  [b]SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\X7665FIN /q"[/b]
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\X7665MEM /q"
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\LJC2550PS3 /q"
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\LJC3800PS /q"
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\LJ4250NPS /q"
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\LJ4250TN /q"
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\LJ4250TN2 /q"
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\LJ8100PCL6 /q"AAP
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\LJ8100PS /q"
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\LJ4300PCL6 /q"
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\MCROPLXF24 /q"
  SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\OJ7310 /q"
ENDIF

IF INGROUP("fso_t")
    ?"Mailroom printer install"
    SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\XWC120PS /q"
  ENDIF


;Changes setting for tabs in IE7 to accomodate netForum
writevalue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TabbedBrowsing","ShortcutBehavior","0","REG_DWORD")

;Turns Internet Explorer start page to blank, enables recover deleted items in Outlook, enables num lock at logon, and sets IM and AutoArchive Preferences
;writevalue("hkey_Current_user\Software\Microsoft\Internet Explorer\Main","Start Page","about:blank","REG_SZ")
;writevalue("HKEY_USERS\.Default\Control Panel\Keyboard","InitialKeyboardIndicators","2","REG_SZ")
writevalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Options","DumpsterAlwaysOn","1","REG_DWORD")
writevalue("hkey_Current_user\Software\Microsoft\Internet Explorer\Main","Window Title","Provided ","REG_SZ")
writevalue("hkey_Current_user\Software\Microsoft\Office\11.0\Outlook\IM","Enabled","0","REG_DWORD")
writevalue("hkey_Current_user\Software\Microsoft\Office\11.0\Outlook\Preferences","DoAging","0","REG_DWORD")
:Skip
exit ;quits the login script
"


Edited by Mart (2009-11-09 05:25 PM)
Edit Reason: Please use code tags when posting code.

Top
#196614 - 2009-11-09 05:27 PM Re: Script is making copies of one printer [Re: Gee]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
If you change the rundll32 option to add printers with the build in AddPrinterConnection() function does this still create copies of that specific printer?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#196615 - 2009-11-09 05:33 PM Re: Script is making copies of one printer [Re: Mart]
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
How do you do that?
Top
#196616 - 2009-11-09 05:53 PM Re: Script is making copies of one printer [Re: Gee]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Replace
 Code:
SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\AMT01\X7665FIN /q"
with
 Code:
AddPrinterConnection('\\AMT01\X7665FIN')

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#196617 - 2009-11-09 05:58 PM Re: Script is making copies of one printer [Re: Glenn Barnas]
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
i replaced the line on the script with the one you gave me and it doesn't make a copy, but on my script when it runs it says 123. Why does it say that?
Top
#196618 - 2009-11-09 07:33 PM Re: Script is making copies of one printer [Re: Gee]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
If you read the manual page, you'd see that the function returns an error code. Since we did not catch the error code, it simply "falls out" onto the screen.

Error 123 says "The filename, directory name, or volume label syntax is incorrect." You can learn this by running
 Code:
net helpmsg 123
at a command line.

Now that you know something is wrong with your shared printer, you can prevent the return code from falling onto the screen by
 Code:
$Rv = AddPrinterConnection('\\AMT01\X7665FIN')
If Not $Rv
  @SERROR ?
Else
  'Printer was mapped' ?
EndIf
After debugging your code, you can either eliminate these messages, or provide some form of error message or recovery process when an error does occur.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 580 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.057 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org