Page 1 of 1 1
Topic Options
#159051 - 2006-03-14 10:53 PM Another SETDEFAULTPRINTER problem
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
Hello everybody,

I am getting error code 2 - system cannot find the specified file specified.

I read a lot in forums that i must use printername and not share name. Hence i changed my printername and sharename to be the same.

I am going crazy with setting printer as default. What is wrong in this code ?

Code :-
-------
IF INGROUP("DA Omgevingen")
DELPRINTERCONNECTION ("\\terminal-deakke\Bro-HL1440")
ADDPRINTERCONNECTION ("\\terminal-deakke\Bro-HL1440")
SETDEFAULTPRINTER ("\\terminal-deakke\Bro-HL1440")
? "This is error"+@Error+"-"+@SError
ENDIF

Is this related to 15 character computer name limitation of windows. My servername comes to 16 chars. But for networksharing i am using only 15chars and that works.

Thanks very much in anticipation.

Top
#159052 - 2006-03-14 11:11 PM Re: Another SETDEFAULTPRINTER problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
From a DOS console can you use NET VIEW \\terminal-deakke
and see that share?

Though I'd expect error 5 if permissions were wrong, please check them as well.


Try this and see what you get.

Code:
IF INGROUP("DA Omgevingen")
DELPRINTERCONNECTION ("\\terminal-deakke\Bro-HL1440")
"This is error "+@Error+" - "+@SError ?
ADDPRINTERCONNECTION ("\\terminal-deakke\Bro-HL1440")
"This is error "+@Error+" - "+@SError ?
SETDEFAULTPRINTER ("\\terminal-deakke\Bro-HL1440")
"This is error "+@Error+" - "+@SError ?
ENDIF


Top
#159053 - 2006-03-14 11:26 PM Re: Another SETDEFAULTPRINTER problem
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
Very thanks for reply,

Yes, net view \\terminal-deakke returns this:
Sharename Type
--------- ----
Bro-HL1440 Print


This is error 1801 - The printer name is invalid
123ncorrect.rror 123 - The filename,directoryname, or the volumelabel syntax is invalid
2This is error 2 - The system cannot find the file specified.

Top
#159054 - 2006-03-14 11:29 PM Re: Another SETDEFAULTPRINTER problem
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
On test to get this sorted out i have given manage and print permissions to all domain users.
Top
#159055 - 2006-03-14 11:40 PM Re: Another SETDEFAULTPRINTER problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well I think you need to first resolve the first error which is probably why you're getting the other 2 errors.

Take it one step at a time.

Can you manually install the printer this way?

Click on Start, Run, then type in
\\terminal-deakke
and hit the Enter key. That should put you on that server.
Then right click on Bro-HL1440 and choose connect.

Does that install the printer correctly?


Edited by NTDOC (2006-03-14 11:43 PM)

Top
#159056 - 2006-03-14 11:53 PM Re: Another SETDEFAULTPRINTER problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
just to point out, this seems to not be a setdefaultprinter issue.
none of the kixtart functions seem to work with this printer.
_________________________
!

download KiXnet

Top
#159057 - 2006-03-14 11:57 PM Re: Another SETDEFAULTPRINTER problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
IF you can manually add the printer as I've shown without any issue, then please try this code again and post the results.

Run this as the ONLY script, do not add it to any other portion of a script.
Also, please let us know what version of KiXtart you're using and the OS version
of the Server this printer is being shared on.


Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

If InGroup(@Domain+'\DA Omgevingen')
If DelPrinterConnection('\\terminal-deakke\Bro-HL1440') = 0
'Deleted printer connection to Bro-HL1440....' + @ERROR + ' - ' + @SERROR ?
Else
'There was an error deleting the printer Bro-HL1440 ' + @ERROR + ' - ' + @SERROR ?
Quit @ERROR
Endif
If AddPrinterConnection('\\terminal-deakke\Bro-HL1440') = 0
'The printer Bro-HL1440 was added ' + @ERROR + ' - ' + @SERROR ?
Else
'There was an error adding the printer Bro-HL1440 ' + @ERROR + ' - ' + @SERROR ?
Quit @ERROR
EndIf
If SetDefaultPrinter('\\terminal-deakke\Bro-HL1440') = 0
'The printer Bro-HL1440 was set as default ' + @ERROR + ' - ' + @SERROR ?
Else
'There was an error setting Bro-HL1440 to default ' + @ERROR + ' - ' + @SERROR ?
Quit @ERROR
EndIf
EndIf


Edited by NTDOC (2006-03-14 11:59 PM)

Top
#159058 - 2006-03-15 12:04 AM Re: Another SETDEFAULTPRINTER problem
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
The printer is physically connected to a printserver. It is installed on a terminal-server so that it can be made available for the users in their terminal session.

I just made a new printer with BROHL1440 and same sharename, ended up with same error. Printer name seems to be not the problem. But the error strangely say's 1801 "Invalid printer name".

I can see the shared printer on the server when i run \\terminal-deakke.
I belive i should be able to connect also if the computers are logged on to the domain. But we are using remotedesktop tool to connect the terminal-server.

Top
#159059 - 2006-03-15 12:39 AM Re: Another SETDEFAULTPRINTER problem
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
I pasted your code and ran only the code, nothing else.
it did not stop for any error nor i saw nothing appearing on the screen.

The printer is not set as default.

The printer is shared on Windows 2003 enterprise edition server with sp1. Kix32.exe File version.4.22.0.0

Top
#159060 - 2006-03-15 12:45 AM Re: Another SETDEFAULTPRINTER problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well it could be the @Domain portion of the code, but that's okay you can remove that portion and put that line back to:

If InGroup('DA Omgevingen')

But the issue appears to be something in / on your network and / or how you're sharing this printer.

You need to get it resolved to a point that you can normally add a printer. If you can't add the printer manually then KiXtart won't be able to either.


Edited by NTDOC (2006-03-15 12:58 AM)

Top
#159061 - 2006-03-15 01:11 AM Re: Another SETDEFAULTPRINTER problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Quote:

I can see the shared printer on the server when i run \\terminal-deakke.
I belive i should be able to connect also if the computers are logged on to the domain. But we are using remotedesktop tool to connect the terminal-server.





But you don't say if you can connect that way or not. So, can you connect or do you get an error?

Top
#159062 - 2006-03-15 01:18 AM Re: Another SETDEFAULTPRINTER problem
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
i tried If InGroup('DA Omgevingen') in place of @Domain. No error or nothing appeared on screen. Printer not set to be default.

On my Dataserver i ran \\terminal-deakke and connected the printer successfully. What can be the network problem if i can succesfully connect the printer. Very strange i am getting printer name is invalid error.

I Shared the printer this way.
New printer - Right clik printer -properties -sharename - list in activedirectory is ticked.

Top
#159063 - 2006-03-15 02:47 PM Re: Another SETDEFAULTPRINTER problem
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
i think i got it right.

I removed the addprinter entry and saw that the printer is still avaliable in the terminal seessions. So i removed the delprinter and addprinter entries and added the below.
SetDefaultPrinter("Bro-HL1440"). I checked with few of the users and it seems that Bro-HL1440 is now the default printer.

Thanks NTDOC and Lonkero very much for you help and assistance.

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 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.06 seconds in which 0.029 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