Page 1 of 2 12>
Topic Options
#42198 - 2003-06-27 08:51 PM New to batch scripting, please help.
JRe Offline
Fresh Scripter

Registered: 2003-06-27
Posts: 11
Loc: USA
Hello,
I've been searching around the site trying to find examples of a script to map shared printers to multiple workstations. The primary server is NT4sp6a (where Kix32 is running), the print server is 2000sp3(server), as are the workstations(WS).
I can't seem to get addprinterconnection("\\server\printername") to work properly. I've tried a few different parameters, but I get an error on the workstation I'm testing on (but the error is so fast i can't read it). I tried putting the ? 'Error - etc. syntax, but it won't work either.
I'm pretty new to this, so any help would be most appreciated.
Thanks,
Joe

Top
#42199 - 2003-06-27 08:52 PM Re: New to batch scripting, please help.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Post the code.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#42200 - 2003-06-27 08:53 PM Re: New to batch scripting, please help.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Try
code:
$rc=addprinterconnection('\\server\printername')
? 'Error '+@ERROR+' - '+@SERROR
? 'AddPrinterConnection = '+$rc
get $rc

_________________________
There are two types of vessels, submarines and targets.

Top
#42201 - 2003-06-27 09:06 PM Re: New to batch scripting, please help.
JRe Offline
Fresh Scripter

Registered: 2003-06-27
Posts: 11
Loc: USA
The first code I tried was:

if addprinterconnection("\\servername\printername") = 0
? "Added Printer Connection..."
endif

And a few vaiation of the above.
Thanks

Top
#42202 - 2003-06-27 09:09 PM Re: New to batch scripting, please help.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Did you try the code I posted? It will give your the error code. Also, what do you mean with different parameters? There is only '\\servername\printername'.
_________________________
There are two types of vessels, submarines and targets.

Top
#42203 - 2003-06-27 09:19 PM Re: New to batch scripting, please help.
JRe Offline
Fresh Scripter

Registered: 2003-06-27
Posts: 11
Loc: USA
Parameters was the wrong choice of words (I tried w/out = 0, :start/:end, break on, etc), and yes, I did try the code but the console just flashes. I can see that it says error, I can't get specifics.
Let me just be sure I have Kix32 installed correctly:
Kix32.exe in the root of C: on the NT PDC.
Kixtart.kix file in the root of C: as well (this is the file I created with the code).
User profile set to use Kix32 as logon script.
What am I doing wrong?
Thanks,
jr

Top
#42204 - 2003-06-27 09:27 PM Re: New to batch scripting, please help.
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
as you are using the old kix32.exe, you see the error with by starting cmd.exe/command.com and starting kixtart via console.
when it gives the error, the console will so you it.

what comes to addprinterconnection() it's actually "\\servername\sharename" you should use.

but that does not explain the error.
_________________________
!

download KiXnet

Top
#42205 - 2003-06-27 09:50 PM Re: New to batch scripting, please help.
JRe Offline
Fresh Scripter

Registered: 2003-06-27
Posts: 11
Loc: USA
Ok, so kix32 is the old version. I thought I was using the version 4, but I guess not.
When you say \sharename, that's the shared printer name, correct? That's what I meant when I said \printername. Is there a difference?
I have not yet run the script directly from the console of the NT PDC, only from logging in on the client test workstation. What is the correct syntax for testing directly from the shell on the NT server (c:>kix32 kixtart.kix etc...)?
Thanks,
jr

Top
#42206 - 2003-06-27 09:53 PM Re: New to batch scripting, please help.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
What exactly are you doing? I suspect yopu don't see anything becasue the script doesn't even run? Doi you call your script locally? Why is your stuff on the system root? That's a big NO-NO.

Also, please read the KiXtart Manual and the FAQ Forum for correctly implementing KiXtart. Based on what you descibe it's not even set up correctly. Thus, fix your setup problems first, then start with a simple script like
code:
? 'KiXtart '+@KIX+' is running'
get $a

Once, you've got this workign, you can work on the printer issue again.
_________________________
There are two types of vessels, submarines and targets.

Top
#42207 - 2003-06-27 09:54 PM Re: New to batch scripting, please help.
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
first, no... it's not old version, just old-style (console version)
second, sure. printershare and name have difference.
just like you can have your users folder shared with other sharename than "e:\users..."

proper syntax?
just start the shell and point to the kixtart executable.
if it's in \\someservers\someshare\somedir, your syntax would be:
\\someservers\someshare\somedir\kix32.exe myscript_location\myscript.kix
_________________________
!

download KiXnet

Top
#42208 - 2003-06-27 09:57 PM Re: New to batch scripting, please help.
JRe Offline
Fresh Scripter

Registered: 2003-06-27
Posts: 11
Loc: USA
Ok, I ran it from the console (c:>kix32) and I got the error 1797 printer driver unknown. Of course, this is an NT 4 machine and the print server is 2000 as are all the print drivers.
Is there a way to resolve this?
thanks,
jr

Top
#42209 - 2003-06-27 10:02 PM Re: New to batch scripting, please help.
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
go to that server and select "additional drivers" and add NT driver there.

report back did it solve it.
thanks.
_________________________
!

download KiXnet

Top
#42210 - 2003-06-27 10:02 PM Re: New to batch scripting, please help.
JRe Offline
Fresh Scripter

Registered: 2003-06-27
Posts: 11
Loc: USA
So if the shared printer is named/shared as printer1 and it's on a server called server1, the code should be addprinterconnection("\\server1\printer1"), correct? This is how I have it set up. Is there any preceding code, such as start or clear or function()?
Thanks

Top
#42211 - 2003-06-27 10:10 PM Re: New to batch scripting, please help.
JRe Offline
Fresh Scripter

Registered: 2003-06-27
Posts: 11
Loc: USA
Attempted to install additional drivers on the 2000 print server, but when I insert the NT 4 server disc, as prompted, it returns an error and does not load. I'm going to try the 2000 sever cd, but I don't think that will work either.
I can't run kix32 from the 2000 server because it's not a DC.
jr

Top
#42212 - 2003-06-27 10:15 PM Re: New to batch scripting, please help.
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it does not matter where you run it from.
now, what is this error you get?

you could also considering changing your main driver to "windows nt/2000" as that is the way most of the printers are configured with.
_________________________
!

download KiXnet

Top
#42213 - 2003-06-27 10:24 PM Re: New to batch scripting, please help.
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Don't the scripts run from %LOGONSERVER%\NETLOGON share of the DC server?

Your clients (unless they are all Domain Admins) will not be able to start \\DCSERVER\C$\KIX32..

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

Top
#42214 - 2003-06-27 10:25 PM Re: New to batch scripting, please help.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Download the latest printer drivers from the manufacturer's website and add them to the shared printer. The shared printer needs the correct printers drivers installed for the corresponding operating systems trying to connect to it, thus you will need to install both the Windows 2000/XP and NT 4.0 printer drivers.
_________________________
There are two types of vessels, submarines and targets.

Top
#42215 - 2003-06-27 10:27 PM Re: New to batch scripting, please help.
JRe Offline
Fresh Scripter

Registered: 2003-06-27
Posts: 11
Loc: USA
Ok, so I got the additional NT driver loaded on the 2K server. It was a file called Badnt4.inf, in D:\PRINTERS\FIXPRNSV\NT4.
I then ran the kix32 from the console and it worked perfectly, loading the printer onto the NT server. So then I tried to run it as a login on the test 2K machine, but it still fails.
What the...?
Do I need to write to the reg of the 2k workstation, or something like this?
jr

Top
#42216 - 2003-06-27 10:32 PM Re: New to batch scripting, please help.
JRe Offline
Fresh Scripter

Registered: 2003-06-27
Posts: 11
Loc: USA
You are quite right, and I'm sure this is the problem, but, do I have to create a share called NETLOGON with Domain User access, because one does not exist. KIX32 is running from the root of the DC. This has to be the issue.
And if I create this share, do I have to specify the path to net logon in the user profile, or will kix32 lok there by default?
Thanks,
jr

quote:
Don't the scripts run from %LOGONSERVER%\NETLOGON share of the DC server?

Your clients (unless they are all Domain Admins) will not be able to start \\DCSERVER\C$\KIX32..

Kent


Top
#42217 - 2003-06-27 10:32 PM Re: New to batch scripting, please help.
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no.
no additionals are needed.

what is this w2k workstation you are talking about?
before it was just w2k server with NT-client failing.
_________________________
!

download KiXnet

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 229 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.113 seconds in which 0.079 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