Page 1 of 1 1
Topic Options
#49418 - 2000-04-05 02:27 PM Roaming profiles and printers
Anonymous
Unregistered


I have a problem with roaming profiles, I have users with two computers in different locations. The problem being is printers and their default. When users logon in the other location the printer default needs to be changed, however users forget which causes problems. Is there a way to have a script which changes the printer default in NT 4? For example concerned with MAC addresses?

Top
#49419 - 2000-04-06 09:27 AM Re: Roaming profiles and printers
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Kix version 3.61 has a function: SETDEFAULTPRINTER

cj

Top
#49420 - 2000-04-06 02:06 PM Re: Roaming profiles and printers
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Zoney...

Since there doesn't seem to be any takers on this one, I'll tell you how we solved the roaming profile / printer problem. It ain't elegant but it's simple and it works great!

As part of our commissioning (setup) process for new workstations, we run a custom built UI that among other things, ask for the path of the nearest network printer for that workstation. The UI then data-fills it into a custom registry key/value as follows...

code:

hkey_local_machine\software\companyname\printer\nearest = "host\share"

The KiX logon script then queries the value, connects and assigns it as default ...

code:

$printer = readvalue ( "hkey_local_machine\software\companyname\printer", "nearest" )

if $printer <> ""
if addprinterconnection ( "$printer" )
?"AddPrinterConnection: @serror"
else
if setdefaultprinter ( $printer )
?"SetDefaultPrinter: @serror"
endif
endif
else
?"Default printer not defined"
endif

exit


You can manually enter this key/value into each workstation locally or remotely as the domain administrator. A lot would depend on how many workstations you have, etc.

The other approach we played around with was to maintain a list of domain printers and
do some sort of lookup when a user logs on. This list would be kept on the domain controllers and queried with KiX... For example, do a readprofilestring() lookup of a network file called printers.ini based on workstation ip subnet...

File printers.ini contains...

code:

[142.121]
printer = \\hostname\floor12_hp4

[142.122]
printer = \\hostname\floor23_hp4

[142.123]
printer = \\hostname\floor24_hp4


And some Kix code like ...

code:

$subnet = substr("@IPADDRESS0",1,7)
$printer = readprofilestring ( "%logonserver%\netlogon\printers.ini", "$subnet", "printer" )
; add and set printer default, etc, blah blah blah ...


It would be nice to have some sort of automatic discovery mechanism through the registry or over the network though ! Anyone ?

Hope this helps !

Shawn.

Top
#49421 - 2000-04-07 08:43 AM Re: Roaming profiles and printers
Anonymous
Unregistered


Excellent. Thankyou very much Shawn
Top
#49422 - 2000-04-07 11:01 AM Re: Roaming profiles and printers
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
sorry, I misunderstood the question.

One method we used once was to have the printer name the same as the workstation nearest it...

workstation DHQ102 (Desktop HeadQuarters 1=sales 02=actual machine)

printer \\printserver\DHQ102

then

setdefaultprinter ("@wksta")

to finish the job. Not the best solution, but it meant that you knew where your printers were. The description of the printserver share as seen in net view told you more info like floor and user etc.

cj

Top
#49423 - 2000-04-07 11:26 AM Re: Roaming profiles and printers
Anonymous
Unregistered


I have had quite a few solutions now, however there was one that I produced but doesn't work!

IF "%LogonServer%\ComputerName"
use LPT1: \\ServerName\PrinterShareName
Endif

Nice and simple but doesn't work. Never mind.

Top
#49424 - 2000-04-07 01:37 PM Re: Roaming profiles and printers
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Generally,I think

IF "%LogonServer%\ComputerName"

will always be true because it is non zero. Are you missing an equal sign & something to test it against? Wouldn't this work best with a Select/Case statement.

_________________________
Jack

Top
#49425 - 2000-04-07 02:00 PM Re: Roaming profiles and printers
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Zoney...

Don't give up !

I think what your probably after is this ...

code:

if %logonserver% = "\\north"
use lpt1: "\\north\north_printer"
endif

if %logonserver% = "\\south"
use lpt1: "\\south\south_printer"
endif


A neat idea but one can't always be sure which of your domain controllers will authenticate you.

Your getting close to something though !

Believe me when I say - Your roaming user's will thank you !

Shawn.



Top
#49426 - 2000-04-10 07:57 AM Re: Roaming profiles and printers
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Zoney...

Borrowing from your example, how about something like this ...

code:

$subnet = substr("@ipaddress0", 1, 11) ; Get workstation subnet address

select

case $subnet = "142.122. 22"
$printer = "\\hostname\printer22"

case $subnet = "142.122. 23"
$printer = "\\hostname\printer23"

case $subnet = "142.122. 24"
$printer = "\\hostname\printer24"

case 1
$printer = ""

endselect

if $printer
use lpt1: "$printer"
endif


Shawn.

Top
#49427 - 2000-04-14 07:56 AM Re: Roaming profiles and printers
bUZZeR Offline
Fresh Scripter

Registered: 1999-12-09
Posts: 19
Loc: N-Hamar, Norway
Just a tip to help out some printerproblems on Win NT domains and on WinXX machines.

When a printer is connected to a computer the register writes down all the printerinfo.

Now, if you change IP adresse or name etc on a shared printer on a server and reconnect to the printer using
AddPrinterConnetion ("\\server\printer") on the client alot of computer will reply with a "you need to install a printer before you can print" and so on.

If you put this line in your Kix script
DELTREE ("Printers")
before your AddPrinterConnection routine the script will remove all printer info and rebuild the info in the registery. This will not remove local printers only printers connected from a share.

Hope this will help someone

------------------
Anders Hansen-Øvre
Getronics AS

_________________________
Anders Hansen-Øvre http://www.contra.no

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
0 registered and 229 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.146 seconds in which 0.086 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