Page 1 of 1 1
Topic Options
#141929 - 2005-06-17 02:04 PM Kix help please- printer logon script
jonesben Offline
Fresh Scripter

Registered: 2005-06-16
Posts: 7
Hi there. I am new to both Kix and these boards so please excuse my limited knowledge. I have been writing a Kix script for our network and have just come to test it- some of it works and some of it doesn't. The bit where it says Lib doesn't execute the setdefaultprinter but does execute the addprinterconnection bit. Also, the bit where it executes the LOCAL.prt file does not call the file- the file works as I have run it manually. Here is the script:
Code:

; THIS SCRIPT MUST BE LOCATED ON THE LOGON SERVER- NOT ON THE LOCAL SYSTEM DRIVE!

; B. Jones, May 2005. © Ruskin Sports College

; Switch off Script Breaking
Break Off

;Make Command Console hidden during Logon
SetConsole("HIDE")

;Start Cases
SELECT

; *** THIS PART OF THE SCRIPT CONCERNS THE DESKTOP COMPUTERS ***

; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Room 10
; =================================================================
; If the Workstation string contains R10, Rm10 or Music10 (Location Room 10), install Room 10 Mono and Room 10 colour
;then set the default to Room 10 Mono.
CASE INSTR(@WkSta,"R10")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
SetDefaultPrinter("\\server\ROOM10")

CASE INSTR(@WkSta,"Rm10")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\ROOM10COL")
SetDefaultPrinter("\\server\ROOM10")

CASE INSTR(@WkSta,"Music002")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\ROOM10COL")
SetDefaultPrinter("\\server\ROOM10")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Room 11
; =================================================================
; If the Workstation string contains R11, Rm11 or Music10 (Location Room 11), install Room 11 Mono and Room 11 Colour
;then set the default to Room 11 Mono.
CASE INSTR(@WkSta,"Rm11")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")
SetDefaultPrinter("\\server\ROOM11Br")

CASE INSTR(@WkSta,"R11")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")
SetDefaultPrinter("\\server\ROOM11Br")

CASE INSTR(@WkSta,"MUSIC10")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")
SetDefaultPrinter("\\server\ROOM11Br")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Library
; =================================================================
; If the Workstation string contains Lib01, Lib02, Lib03, Lib04, Lib05 or Lib06 (Location Library), install Library Mono and Library Colour
;then set the default to Library Mono.
CASE INSTR(@WkSta,"Lib01")
AddPrinterConnection("\\server\LibraryBW")
AddPrinterConnection("\\Lib02\LibraryCol")
SetDefaultPrinter("\\server\LibraryBW")

CASE INSTR(@WkSta,"Lib02")
AddPrinterConnection("\\server\LibraryBW")
AddPrinterConnection("\\Lib02\LibraryCol")
SetDefaultPrinter("\\server\LibraryBW")

CASE INSTR(@WkSta,"Lib03")
AddPrinterConnection("\\server\LibraryBW")
AddPrinterConnection("\\Lib02\LibraryCol")
SetDefaultPrinter("\\server\LibraryBW")

CASE INSTR(@WkSta,"Lib04")
AddPrinterConnection("\\server\LibraryBW")
AddPrinterConnection("\\Lib02\LibraryCol")
SetDefaultPrinter("\\server\LibraryBW")

CASE INSTR(@WkSta,"Lib05")
AddPrinterConnection("\\server\LibraryBW")
AddPrinterConnection("\\Lib02\LibraryCol")
SetDefaultPrinter("\\server\LibraryBW")

CASE INSTR(@WkSta,"Lib06")
AddPrinterConnection("\\server\LibraryBW")
AddPrinterConnection("\\Lib02\LibraryCol")
SetDefaultPrinter("\\server\LibraryBW")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Science Staff Room
; =================================================================
; If the Workstation string contains Lib07 (Location Science Staff Room), install Science Staff Room Colour
;then set the default to Science Staff Room Colour.
CASE INSTR(@WkSta,"Lib07")
AddPrinterConnection("\\Lib07\EpsonSty")
SetDefaultPrinter("\\Lib07\EpsonSty")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: English Block
; =================================================================
; If the Workstation string contains E1_1, E1_2, E2_1, E2_2, Eng31, E3_2, E4_1 or E4_2 (Location English Block),
;install English Block Mono and English Block Colour then set the default to English Block Mono.
CASE INSTR(@WkSta,"E1_1")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
SetDefaultPrinter("\\E1_1\EngBW")

CASE INSTR(@WkSta,"E1_2")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
SetDefaultPrinter("\\E1_1\EngBW")

CASE INSTR(@WkSta,"E2_1")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
SetDefaultPrinter("\\E1_1\EngBW")

CASE INSTR(@WkSta,"E2_2")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
SetDefaultPrinter("\\E1_1\EngBW")

CASE INSTR(@WkSta,"E2_2")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
SetDefaultPrinter("\\E1_1\EngBW")

CASE INSTR(@WkSta,"Eng31")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
SetDefaultPrinter("\\E1_1\EngBW")

CASE INSTR(@WkSta,"E3_2")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
SetDefaultPrinter("\\E1_1\EngBW")

CASE INSTR(@WkSta,"E4_1")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
SetDefaultPrinter("\\E1_1\EngBW")

CASE INSTR(@WkSta,"E4_2")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
SetDefaultPrinter("\\E1_1\EngBW")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Staff Room
; =================================================================
; If the workstation string contains Staff01 or Staff02 (Location Staff Room), install Staff Room Mono
;then set the default to Staff Room Mono.
CASE INSTR(@WkSta,"Staff01")
AddPrinterConnection("\\Staff02\StaffRoom")
AddPrinterConnection("\\server\Rm11Colour")
SetDefaultPrinter("\\Staff02\StaffRoom")

CASE INSTR(@WkSta,"Staff02")
AddPrinterConnection("\\Staff02\StaffRoom")
AddPrinterConnection("\\server\Rm11Colour")
SetDefaultPrinter("\\Staff02\StaffRoom")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Music Suite
; =================================================================
; If the Workstation string contains Hpmusic01, Hpmusic02, Hpmusic03, Hpmusic04, Hpmusic05,
;Hpmusic06 or Hpmusic07 (Location Music Suite), install Music Suite Mono then set the default to Music Suite Mono.
CASE INSTR(@WkSta,"Hpmusic")
AddPrinterConnection("\\Hpmusic05\Music")
SetDefaultPrinter("\\Hpmusic05\Music")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Pyramid
; =================================================================
; If the Workstation string contains P01, P03 or P07hp (Location Pyramid), install Pyramid Mono
; then set the default to Pyramid Mono.
CASE INSTR(@WkSta,"P0")
AddPrinterConnection("\\P02\Brother")
SetDefaultPrinter("\\P02\Brother")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Server Room
; =================================================================
; If the Workstation string contains Svrroompc (Location Mrs Pearce's Cupboard, Server Room),
;install all avaliable shared priners then set the default to Room 10 Mono.
CASE INSTR(@WkSta,"Svrroompc")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")
AddPrinterConnection("\\Staff02\StaffRoom")
AddPrinterConnection("\\P02\Brother")
AddPrinterConnection("\\Cdt1\BrotherH")
AddPrinterConnection("\\Hpmusic05\Music")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
AddPrinterConnection("\\Lib07\EpsonSty")
AddPrinterConnection("\\server\tbbrother1")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\ROOM10")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: CDT
; =================================================================
; If the Workstation string contains Cdt1 or Cdt-02 (Location CDT, Room E), install CDT
; Mono then set the default to CDT Mono.
CASE INSTR(@WkSta,"Cdt1")
AddPrinterConnection("\\Cdt1\BrotherH")
SetDefaultPrinter("\\Cdt1\BrotherH")

CASE INSTR(@WkSta,"Cdt-02")
AddPrinterConnection("\\Cdt1\BrotherH")
SetDefaultPrinter("\\Cdt1\BrotherH")

; If the Workstation string contains Cdt-003 or Cbt-04 (Location CDT, Room D), take no action.
CASE INSTR(@WkSta,"Cdt-003")

CASE INSTR(@WKSta,"Cbt-004")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Others (Mostly where a printer is not locally
; shared but the workstation name must appear in this section to aviod errors)!
; =================================================================
; If the Workstation string contains Mfl01, take no action.
CASE INSTR(@WkSta,"Mfl01")

; If the Workstation string contains Art, take no action
CASE INSTR(@WkSta,"Art")

; If the Workstation string contains Ca01, take no action
CASE INSTR(@WkSta,"Ca01")

; =================================================================




; *** THIS PART OF THE SCRIPT CONCERNS THE TABLET COMPUTERS ***

; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: 1st Floor Tablets
; =================================================================
; If the Workstation string contains TABLET01-16 (Location 1st Tablet Trolley), install 1st
;Floor Tablet Trolley Mono then set the default to 1st Floor Tablet Trolley Mono.
CASE INSTR(@WkSta,"TABLET01")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET02")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET03")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET04")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET05")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET06")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET07")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET08")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET09")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET10")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET11")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET12")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET13")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET14")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET15")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")

CASE INSTR(@WkSta,"TABLET16")
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Ground Floor Tablets
; =================================================================
; If the Workstation string contains TABLET17-32 (Location Ground Floor Tablet Trolley),
; install Ground Floor Tablet Trolley Mono then set the default to Ground Floor Tablet Trolley Mono.
CASE INSTR(@WkSta,"TABLET17")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET18")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET19")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET20")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET21")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET22")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET23")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET24")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET25")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET26")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET27")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET28")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET29")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET30")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET31")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")

CASE INSTR(@WkSta,"TABLET32")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Spare Tablets
; =================================================================
; If the Workstation string contains TABLET33-38 (Location Server Room), install Room 10 Mono,
;Room 10 Colour, Room 11 Mono, Room 11 Colour, 1st Floor Tablet Trolley Mono and Ground Floor
;Tablet Trolley Mono then do not set a default printer.
CASE INSTR(@WkSta,"TABLET33")
AddPrinterConnection("\\server\tbbrother2")
AddPrinterConnection("\\server\tbbrother1")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")

CASE INSTR(@WkSta,"TABLET34")
AddPrinterConnection("\\server\tbbrother2")
AddPrinterConnection("\\server\tbbrother1")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")

CASE INSTR(@WkSta,"TABLET35")
AddPrinterConnection("\\server\tbbrother2")
AddPrinterConnection("\\server\tbbrother1")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")

CASE INSTR(@WkSta,"TABLET36")
AddPrinterConnection("\\server\tbbrother2")
AddPrinterConnection("\\server\tbbrother1")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")

CASE INSTR(@WkSta,"TABLET37")
AddPrinterConnection("\\server\tbbrother2")
AddPrinterConnection("\\server\tbbrother1")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")

CASE INSTR(@WkSta,"TABLET38")
AddPrinterConnection("\\server\tbbrother2")
AddPrinterConnection("\\server\tbbrother1")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")

CASE INSTR(@WkSta,"TABLET50")
AddPrinterConnection("\\server\tbbrother2")
AddPrinterConnection("\\server\tbbrother1")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")
; =================================================================



; *** THIS PART OF THE SCRIPT CONCERNS THE LAPTOP COMPUTERS ***

; THIS PART OF THE SCRIPT CONCERNS THE PRELIMINARY CODING FOR THE LOCATION: Staff Laptops
; =================================================================


; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: All Staff Laptops
; =================================================================
CASE INSTR(@WkSta,"Dell")
Call "C:\LOCAL.prt"

CASE INSTR(@WkSta,"dell")
Call "C:\LOCAL.PRT"

CASE INSTR(@WkSta,"Hplaptop")
Call "C:\LOCAL.PRT"

CASE INSTR(@WkSta,"Laptop")
Call "C:\LOCAL.PRT"

CASE INSTR(@WkSta,"laptop")
Call "C:\LOCAL.PRT"

CASE INSTR(@WkSta,"lp")
Call "C:\LOCAL.PRT"
; =================================================================



; THIS PART OF THE SCRIPT CONCERNS THE ERROR REPORTING FUNCTION OF THIS SCRIPT
; =================================================================
CASE 1
$Selection = Messagebox("Sorry @FullName, the workstation name, @WkSta, could not
;be found in the Active Directory structure of the @Domain @ProductType @DOS domain.
;Please contact your network administrator with this fault immediatley! You will be
;logged off momentairly due to security reasons...

Workstation Name: @WkSta
Operating System: @ProductType
Windows Version: @DOS
Logon Server: @LServer
User Type: @Priv
User Group: @PrimaryGroup
ErrorTime: @Time
LAN Card: @Address

Thank you. PLEASE CONTACT YOUR NETWORK ADMINISTRATOR!

© of Ruskin Sports College, May 2005. Kixtart™ ","Error","0","")
If $Selection = 1
$RC = Logoff(1)

EndIf
; =================================================================

; End Cases
ENDSELECT



Thanks very much- any help in solving this wil be appreciated

Ben


Edited by jonesben (2005-06-17 10:34 PM)

Top
#141930 - 2005-06-17 02:23 PM Re: Kix help please- printer logon script
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Ensure that the printer name and the printer share name are exactly the same or it gets very confusing.

AddPrinterConnection() requires the share name as a parameter, SetDefaultPrinter() requires the printer name.

You should split the comment lines down into shorter lengths to suit the board software otherwise people may ignore your post.

Top
#141931 - 2005-06-17 03:18 PM Re: Kix help please- printer logon script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Please edit your post and break the long lines.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#141932 - 2005-06-19 12:12 PM Re: Kix help please- printer logon script
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11611
Loc: CA
Ben,

I took the liberty of re-writing your script. This method uses .INI as a means to look for invalid PCs, but this is NOT a robust method of determining that.

Not done here, but you could also control all these printer connections using a .INI file.

Recommend using KiXtart 4.22 or 4.23 for this script.
 
Please review this code and make sure all the names are valid and let us know how it goes.

    VALIDPC.INI

Code:
[AUTHORIZED_PC]
CDT-02=1
CDT1=1
DELL=1
E1_1=1
E1_2=1
E2_1=1
E2_2=1
E3_2=1
E4_1=1
E4_2=1
ENG31=1
HPLAPTOP=1
HPMUSIC01=1
HPMUSIC02=1
HPMUSIC03=1
HPMUSIC04=1
HPMUSIC05=1
HPMUSIC06=1
HPMUSIC07=1
LAPTOP=1
LP=1
Lib01=1
Lib02=1
Lib03=1
Lib04=1
Lib05=1
Lib06=1
Lib07=1
MUSIC002=1
MUSIC10=1
P01=1
P03=1
P07HP=1
R10=1
R11=1
RM10=1
RM11=1
STAFF01=1
STAFF02=1
SvrRoomPC=1
TABLET01=1
TABLET02=1
TABLET03=1
TABLET04=1
TABLET05=1
TABLET06=1
TABLET07=1
TABLET08=1
TABLET09=1
TABLET10=1
TABLET11=1
TABLET12=1
TABLET13=1
TABLET14=1
TABLET15=1
TABLET16=1
TABLET17=1
TABLET18=1
TABLET19=1
TABLET20=1
TABLET21=1
TABLET22=1
TABLET23=1
TABLET24=1
TABLET25=1
TABLET26=1
TABLET27=1
TABLET28=1
TABLET29=1
TABLET30=1
TABLET31=1
TABLET32=1
TABLET33=1
TABLET34=1
TABLET35=1
TABLET36=1
TABLET37=1
TABLET38=1
TABLET50=1


 
Code:
; *** File Name:     PRINTERS.KIX
; *** Date Created: 5/15/2005 2:30PM - By B. Jones, © Ruskin Sports College
; *** Comments: THIS SCRIPT MUST BE LOCATED ON THE LOGON SERVER- NOT ON THE LOCAL SYSTEM DRIVE!
 
; =================================================================
; ********** REVISION HISTORY
; 001.01 *** 6/19/2005 2:22AM by By B. Jones
; ********** Modified code use ASCAN to locate computers for printer setup
; 001.00 *** 5/15/2005 2:30PM by By B. Jones
; ********** Initial release for production
 
; =================================================================
; DECLARATIONS
; =================================================================
Break Off
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('WrapAtEOL','On')
 
;Make Command Console hidden during Logon
$SO=SetConsole('HIDE')
;Start Cases
Dim $LibComps,$Room10,$Room11,$EnglishComps,$StaffComps,$HPMusicComps,$PyramidComps,
$CDTComps,$Tablet1Comps,$Tablet2Comps,$Tablet3Comps,$ValidPC,$Msg,$EndSession
 
; *** THIS PART OF THE SCRIPT CONCERNS THE DESKTOP COMPUTERS ***
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Room 10
; =================================================================
; If the Workstation string contains R10, Rm10 or Music10 (Location Room 10), install Room 10 Mono and Room 10 Colour
; then set the default to Room 10 Mono.
$Room10=Split('R10|RM10|MUSIC002','|')
If AScan($Room10,@WKSTA)>=0
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
SetDefaultPrinter("\\server\ROOM10")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Room 11
; =================================================================
; If the Workstation string contains R11, Rm11 or Music10 (Location Room 11), install Room 11 Mono and Room 11 Colour
; then set the default to Room 11 Mono.
$Room11=Split('R11|RM11|MUSIC10','|')
If AScan($Room11,@WKSTA)>=0
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")
SetDefaultPrinter("\\server\ROOM11Br")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Library
; =================================================================
; If the Workstation string contains Lib01, Lib02, Lib03, Lib04, Lib05 or Lib06 (Location Library), install Library Mono
; and Library Colour then set the default to Library Mono.
$LibComps=Split('Lib01|Lib02|Lib03|Lib04|Lib05|Lib06','|')
If AScan($LibComps,@WKSTA)>=0
AddPrinterConnection("\\server\LibraryBW")
AddPrinterConnection("\\Lib02\LibraryCol")
SetDefaultPrinter("\\server\LibraryBW")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Science Staff Room
; =================================================================
; If the Workstation string contains Lib07 (Location Science Staff Room), install Science Staff Room Colour then set the
; default to Science Staff Room Colour.
If InStr(@WKSTA,'Lib07')
AddPrinterConnection("\\Lib07\EpsonSty")
SetDefaultPrinter("\\Lib07\EpsonSty")
EndIF
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: English Block
; =================================================================
; If the Workstation string contains E1_1, E1_2, E2_1, E2_2, Eng31, E3_2, E4_1 or E4_2 (Location English Block), install
; English Block Mono and English Block Colour then set the default to English Block Mono.
$EnglishComps=Split('E1_1|E1_2|E2_1|E2_2|ENG31|E3_2|E4_1|E4_2','|')
If AScan($EnglishComps,@WKSTA)>=0
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
SetDefaultPrinter("\\E1_1\EngBW")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Staff Room
; =================================================================
; If the workstation string contains Staff01 or Staff02 (Location Staff Room), install Staff Room Mono then set the
; default to Staff Room Mono.
$StaffComps=Split('STAFF01|STAFF02','|')
If AScan($StaffComps,@WKSTA)>=0
AddPrinterConnection("\\Staff02\StaffRoom")
AddPrinterConnection("\\server\Rm11Colour")
SetDefaultPrinter("\\Staff02\StaffRoom")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Music Suite
; =================================================================
; If the Workstation string contains Hpmusic01, Hpmusic02, Hpmusic03, Hpmusic04, Hpmusic05, Hpmusic06 or Hpmusic07
; (Location Music Suite), install Music Suite Mono then set the default to Music Suite Mono.
$HPMusicComps=Split('HPMUSIC01|HPMUSIC02|HPMUSIC03|HPMUSIC04|HPMUSIC05|HPMUSIC06|HPMUSIC07','|')
If AScan($HPMusicComps,@WKSTA)>=0
AddPrinterConnection("\\Hpmusic05\Music")
SetDefaultPrinter("\\Hpmusic05\Music")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Pyramid
; =================================================================
; If the Workstation string contains P01, P03 or P07hp (Location Pyramid), install Pyramid Mono then set the default to
; Pyramid Mono.
$PyramidComps=Split('P01|P03|P07HP','|')
If AScan($PyramidComps,@WKSTA)>=0
AddPrinterConnection("\\Hpmusic05\Music")
SetDefaultPrinter("\\Hpmusic05\Music")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Server Room
; =================================================================
; If the Workstation string contains Svrroompc (Location Mrs Pearce's Cupboard, Server Room), install all avaliable
; shared priners then set the default to Room 10 Mono.
If InStr(@WKSTA,'SvrRoomPC')
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")
AddPrinterConnection("\\Staff02\StaffRoom")
AddPrinterConnection("\\P02\Brother")
AddPrinterConnection("\\Cdt1\BrotherH")
AddPrinterConnection("\\Hpmusic05\Music")
AddPrinterConnection("\\E1_1\EngBW")
AddPrinterConnection("\\server\TallyGen")
AddPrinterConnection("\\Lib07\EpsonSty")
AddPrinterConnection("\\server\tbbrother1")
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\ROOM10")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: CDT
; =================================================================
; If the Workstation string contains Cdt1 or Cdt-02 (Location CDT, Room E), install CDT Mono then set the default to CDT Mono.
$CDTComps=Split('CDT1|CDT-02','|')
If AScan($CDTComps,@WKSTA)>=0
AddPrinterConnection("\\Cdt1\BrotherH")
SetDefaultPrinter("\\Cdt1\BrotherH")
EndIf
 
; If the Workstation string contains Cdt-003 or Cbt-04 (Location CDT, Room D), take no action.
;"Cdt-003"
;"Cbt-004"
; =================================================================
 
; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Others (Mostly where a printer is not locally shared but the workstation
; name must appear in this section to aviod errors)!
; =================================================================
; If the Workstation string contains Mfl01, take no action.
;"Mfl01"
 
; If the Workstation string contains Art, take no action
;"Art"
 
; If the Workstation string contains Ca01, take no action
;"Ca01"
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE TABLET COMPUTERS ***
 
; THIS PART OF THE SCRIPT CONCERNS THE LOCATION: 1st Floor Tablets
; =================================================================
; If the Workstation string contains TABLET01-16 (Location 1st Tablet Trolley), install 1st Floor Tablet Trolley Mono
; then set the default to 1st Floor Tablet Trolley Mono.
$Tablet1Comps=Split('TABLET01|TABLET02|TABLET03|TABLET04|TABLET05|TABLET06|TABLET07|TABLET08|TABLET09|TABLET10|TABLET11|'+
'TABLET12|TABLET13|TABLET14|TABLET15|TABLET16','|')
If AScan($Tablet1Comps,@WKSTA)>=0
AddPrinterConnection("\\server\tbbrother1")
SetDefaultPrinter("\\server\tbbrother1")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Ground Floor Tablets
; =================================================================
; If the Workstation string contains TABLET17-32 (Location Ground Floor Tablet Trolley), install Ground Floor Tablet
; Trolley Mono then set the default to Ground Floor Tablet Trolley Mono.
$Tablet2Comps=Split('TABLET17|TABLET18|TABLET19|TABLET20|TABLET21|TABLET22|TABLET23|TABLET24|TABLET25|TABLET26|TABLET27|'+
'TABLET28|TABLET29|TABLET30|TABLET31|TABLET32','|')
If AScan($Tablet2Comps,@WKSTA)>=0
AddPrinterConnection("\\server\tbbrother2")
SetDefaultPrinter("\\server\tbbrother2")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: Spare Tablets
; =================================================================
; If the Workstation string contains TABLET33-38 (Location Server Room), install Room 10 Mono, Room 10 Colour, Room 11 Mono,
; Room 11 Colour, 1st Floor Tablet Trolley Mono and Ground Floor Tablet Trolley Mono then do not set a default printer.
$Tablet3Comps=Split('TABLET33|TABLET34|TABLET35|TABLET36|TABLET37|TABLET38|TABLET50','|')
If AScan($Tablet3Comps,@WKSTA)>=0
AddPrinterConnection("\\server\tbbrother2")
AddPrinterConnection("\\server\tbbrother1")
AddPrinterConnection("\\server\ROOM10")
AddPrinterConnection("\\server\RM10COL")
AddPrinterConnection("\\server\ROOM11Br")
AddPrinterConnection("\\server\Rm11Colour")
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LAPTOP COMPUTERS ***
 
; *** THIS PART OF THE SCRIPT CONCERNS THE PRELIMINARY CODING FOR THE LOCATION: Staff Laptops
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE LOCATION: All Staff Laptops
; =================================================================
$Tablet3Comps=Split('DELL|HPLAPTOP|LAPTOP|LP','|')
If AScan($Tablet3Comps,@WKSTA)>=0
Call 'C:\LOCAL.prt'
EndIf
; =================================================================
 
; *** THIS PART OF THE SCRIPT CONCERNS THE ERROR REPORTING FUNCTION OF THIS SCRIPT
; =================================================================
 
$ValidPC=ReadProfileString(@ScriptDir+'\validpc.ini','AUTHORIZED_PC',@WKSTA)
If Not $ValidPC
$Msg=MessageBox('Sorry ' + @FullName + ', this workstation named: [' +@WKSTA+ '] could not be found in the Active '+
'Directory structure of the ' + @DOMAIN + ' domain. ' + @CRLF +
'Please contact your network administrator with this fault immediatley! ' + @CRLF +
'You will be logged off momentairly due to security reasons...' + @CRLF + @CRLF +
'Workstation Name: ' + @WKSTA + @CRLF +
'Operating System: ' + @ProductType + @CRLF +
'Windows Version: ' + @DOS + @CRLF +
'Logon Server: ' + @LServer + @CRLF +
'User Type: ' + @Priv + @CRLF +
'User Group: ' + @PrimaryGroup + @CRLF +
'ErrorTime: ' + @DATE + ' ' + @Time + @CRLF +
'IP Address: ' + @IPADDRESS0 + @CRLF +
'LAN Card: ' + @Address + @CRLF + @CRLF +
'Thank you. PLEASE CONTACT YOUR NETWORK ADMINISTRATOR!' + @CRLF +
'© Ruskin Sports College, May 2005. Kixtart™ ','Unauthorized PC Alert',4144)
 
; Computer not found in the VALIDPC.INI file, log the system off
$EndSession=Logoff(1)
EndIf
; *** END OF SCRIPT
; =================================================================


 

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 301 anonymous users online.
Newest Members
Praveer, Ollero, rayyo, Foxlicht, DonChild
17742 Registered Users

Generated in 0.038 seconds in which 0.015 seconds were spent on a total of 12 queries. Zlib compression enabled.

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