Page 1 of 2 12>
Topic Options
#74018 - 2003-03-13 04:53 PM Map Printer - Best solution?
Mabraham-ca Offline
Fresh Scripter

Registered: 2003-02-17
Posts: 30
Loc: Toronto
Friends,
I would like to map printers according to groups and setup one of the printer as default printer. Groups may have more than one printers and most of the clients are in Windows 95, 98, NT 2000. What are the best way to do this. I thought to use the following script, however, I have couple of doubts about that.
Question:
1. How the drivers loaded to the workstation with the following script?
2. What will happen if printer is already configured for the workstation? - (specially if the user logon top the same workstation second time)
3. What is the benefit if I use the .ini file with this script, is windows 95/98 able to recognize the .ini file? [Roll Eyes]
Thanks. Mathew

Code:

IF INGROUP('Group_A')
$rc=ADDPRINTERCONNECTION('\\MYT-1001\HP-Sales-001')
ENDIF

Top
#74019 - 2003-03-13 05:11 PM Re: Map Printer - Best solution?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If you would take a look at the KiXtart Manual, then you would discover that Windows 9x does not support ADDPRINTERCONNECTION or it's companion functions.

.INi files have nothing to do with the OS.

.INI files make it easier to implement changes.

Please post code in between [CODE] tags.
_________________________
There are two types of vessels, submarines and targets.

Top
#74020 - 2003-03-13 06:01 PM Re: Map Printer - Best solution?
Mabraham-ca Offline
Fresh Scripter

Registered: 2003-02-17
Posts: 30
Loc: Toronto
Thanks For the info.
I have noticed ADDPRINTERCONNECTION ("printer name")This function is available only on Windows NT and up,
is there is any other command I can use for windows 95 for adding printers.

thanks

Top
#74021 - 2003-03-13 06:08 PM Re: Map Printer - Best solution?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
IIRC there is some tool provided by microsoft...
nt-resource kit or somewhere.
_________________________
!

download KiXnet

Top
#74022 - 2003-03-13 06:09 PM Re: Map Printer - Best solution?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Simple asswer: NO

However, you can use e.g. SENDKEYS() to manually go through the printer installation wizard.

However, it's not worth the effort as Win9x is EOL anyway and it's another reason to upgrade to business-oriented, professional operating systems like Windows NT/2000/XP/2003.

[ 13. March 2003, 18:57: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#74023 - 2003-03-13 06:45 PM Re: Map Printer - Best solution?
Mabraham-ca Offline
Fresh Scripter

Registered: 2003-02-17
Posts: 30
Loc: Toronto
So there is no script solutions to map the Printers for W95/98?

What is IIRC I could not see any information on this in the Microsoft site.

Thanks. Mathew

Top
#74024 - 2003-03-13 06:50 PM Re: Map Printer - Best solution?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I quessed that.
If I Recall Correctly.

let me see ms-site too...
_________________________
!

download KiXnet

Top
#74025 - 2003-03-13 07:09 PM Re: Map Printer - Best solution?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah, found it.
not on ms site but remembered somehow the utilname.

con2prt is util of NT Zero Administration Kit
I have not read about XP but with other OSes it should work just fine.

related info:
http://www.ss64.com/nt/con2prt.html

anyway, the link does not work anymore but I quess you can search the place on your own...
or even find a cd with it.

[ 13. March 2003, 19:10: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#74026 - 2003-03-13 08:21 PM Re: Map Printer - Best solution?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Sorry to barge in here..

What about -

Add Printer on 9x clients!

Does this help?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#74027 - 2003-03-13 08:25 PM Re: Map Printer - Best solution?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yes, that's the one thread I was talking about when mentioning SENDKEYS(). I was just too lazy to search for it myself.
_________________________
There are two types of vessels, submarines and targets.

Top
#74028 - 2003-03-13 08:33 PM Re: Map Printer - Best solution?
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
What about AddPrinterConnection Method? It only requires Wsh 1.0 to run.
Top
#74029 - 2003-03-13 08:38 PM Re: Map Printer - Best solution?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
HEY!
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthaddwindowsprinterconnection.asp

now I must think...
this might be the same issue that is with kix' addprinterconnection!

the link chris provided, isn't it just the same as saying:
code:
shell "net use lpt1: \\server\printer"

_________________________
!

download KiXnet

Top
#74030 - 2003-03-13 09:57 PM Re: Map Printer - Best solution?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hmmm.. Yes, your correct Lonkero, but it does say that this one supports Win 9x

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthaddwindowsprinterconnection.asp

BUT The printer driver MUST already be installed.

Windows 9x/Me:
object.AddWindowsPrinterConnection(
strPrinterPath,
strDriverName[,strPort]
)

Remarks
Using this method is similar to using the Printer option on Control Panel to add a printer connection. Unlike the AddPrinterConnection method, this method allows you to create a printer connection without directing it to a specific port, such as LPT1. If the connection fails, an error is thrown. In Windows 9x/Me, the printer driver must already be installed on the machine for the AddWindowsPrinterConnection method to work. If the driver is not installed, Windows returns an error message.

[ 13. March 2003, 21:58: Message edited by: NTDOC ]

Top
#74031 - 2003-03-13 10:15 PM Re: Map Printer - Best solution?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
All this flogging of an almost dead horse! Just let Wintendo die quietly from neglect.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#74032 - 2003-03-13 10:15 PM Re: Map Printer - Best solution?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, have you tried to install drivers and then use kix's addprinterconnection() ?

ruud may thought that it's better to say it does not work than try to explain what should be done to make it work.
I can't test for the obvious reason that I don't have any wintosh machines.
_________________________
!

download KiXnet

Top
#74033 - 2003-03-13 10:26 PM Re: Map Printer - Best solution?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Sorry Mabraham-ca,

But the basic answer is NO you can not add printers to Windows 9x systems with anywhere near a good success rate.

1. Using the SEND-KEY method will fail if you are off or miss just 1 dialog box either by name or timing.

2. Windows 9x often wants different drivers even for Network depending on what has changed, you would have to know/anticipate all drivers (and supply an installation folder), and dialog boxes.

3. Windows 95 is no longer supported by Microsoft.

4. Windows 98 will soon join item 3

5. Windows ME should not be in a Corp environment

6. Even writing a C, C++ code to install a printer on Win9x will give similar issues of item 2

7. Sorry again, I have to agree with Jens and Les... Let it die. Either Windows 95 or the idea of trying to script a printer installation. Its just not worth your time and headache.

Top
#74034 - 2003-03-13 10:59 PM Re: Map Printer - Best solution?
Mabraham-ca Offline
Fresh Scripter

Registered: 2003-02-17
Posts: 30
Loc: Toronto
Thanks a lot - I really appriciate all of your help.

I am dropping the plan for mapping the printers for w95/98. However, I would like to know get some feedback from you guys for the following script.
Specially I need to know if I need to delete the printer mapping before it map for Windows NT and up , I do not know how to delete the printer so please let me know the commands for that.

; Print Mapping
IF InGroup("Sales")
$null=AddPrinterConnection("\\myt-1001\HP-sales")
;$null=AddPrinterConnection("\\myt-1001\HP-sales-01")
;$null=SetDefaultPrinter("\\myt-1001\HP-sales")
? "Added printer connection.........."
ENDIF
--------------------------
Original Script:---------------------
md "\\myt-1001\home\@userid"
USE p: /DELETE
USE p: "\\myt-1001\@USERID$"

IF @inwin
GOSUB nt
ELSE
GOSUB win95
ENDIF
:end
? "script completed"
EXIT

:nt
IF %type% = "server"
RETURN
ENDIF

IF RedirectOutput("\\Myt-1001\Users\LoginLogs\@WKSTA.log", 1) = 0
? "Opened '\\myt-1001\Users\LoginLogs\@WKSTA.log' "+@time
ENDIF


? "ERRORS ARE " +@error " WHICH MEANS " + @serror
?
; Print Mapping
IF InGroup("Sales")
$null=AddPrinterConnection("\\myt-1001\HP-sales")
;$null=AddPrinterConnection("\\myt-1001\HP-sales-01")
;$null=SetDefaultPrinter("\\myt-1001\HP-sales")
? "Added printer connection.........."
ENDIF

IF InGroup("Marketing")
$null=AddPrinterConnection("\\myt-1001\HP-marketing")
;$null=AddPrinterConnection("\\myt-1001\HP-marketing-01")
;$null=SetDefaultPrinter("\\myt-1001\HP-marketing")
? "Added printer connection.........."
ENDIF

IF InGroup("Sales")
USE N: /delete /persistent
USE N: "\\myt-1001\Sales"
ENDIF

IF InGroup("Marketing")
USE Y: /delete /persistent
USE Y: "\\myt-1001\marketing"
ENDIF
RETURN
; Windows 95 Share Mapping

:win95
IF INGROUP ("myt\sales")
;$t = "Connecting drive I:" GOSUB text
USE i: /DELETE
USE i: "\\myt-1001\sales"
ENDIF
;IF RedirectOutput("\\MYT-1001\Users\LoginLogs\@WKSTA.log", 1) = 0
;? "Opened '\\Gfclnt03\Users\LoginLogs\@WKSTA.log' "+@time
;ENDIF


;? "ERRORS ARE " +@error " WHICH MEANS " + @serror
;?

IF INGROUP ("myt\marketing")
;$t = "Connecting drive I:" GOSUB text
USE i: /DELETE
USE i: "\\myt-1001\marketing"

GOSUB debug
RETURN

Top
#74035 - 2003-03-13 11:18 PM Re: Map Printer - Best solution?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
There are cleaner ways to write your script without using GOSUB.
quote:

md "\\myt-1001\home\@userid"

has nothign to do with login scritps and therefore should not be there.

Use build-in KiXtart macros wherever possible instead of environment variables, see %TYPE%.

Make use of the UDFs in the UDF library to create easy to maintain scripts.

Store drive/printer mapping info in a .INI file.

Read the FAQs!
_________________________
There are two types of vessels, submarines and targets.

Top
#74036 - 2003-03-13 11:47 PM Re: Map Printer - Best solution?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now boys...

I have had never problems with con2prt.exe which is even product of m$ and designed for these things.

I vote also for dropping support, this way you will finally get rid of the wintosh machines...
just like I did a year ago.

but, it is doable and the solution is simple!
_________________________
!

download KiXnet

Top
#74037 - 2003-03-14 12:51 AM Re: Map Printer - Best solution?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hate to beat this dead horse more Lonkero, but if you go read about con2prnt you will see it is designed for CONNECTING NT systems to network printers, not for installing drivers for Win9x

There is another utility with more enhanced abilities, but it too requires that the DRIVER ALREADY be installed for Win9x

http://www.jsiinc.com/SUBM/tip6000/rh6065.htm

Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 1607 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.075 seconds in which 0.028 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