Page 1 of 1 1
Topic Options
#62940 - 2002-02-07 06:18 PM Roaming Profiles - Default Printers - PLEASE HELP
BDA Offline
Lurker

Registered: 2002-02-07
Posts: 4
I'm new to scripting, so any help would be greatly appreciated. We are using roaming profiles in a W2K environment. Kixtart doesn't seem to recognize what groups the PCs are in (only users), so we've set an System Environment Variable (DefaultPrinter) on each PC which Kixtart can use to identify that computer's default printer. Below are the scripts I'm testing. My problem is the SetDefault script stops running on the line If @ERROR = 0. What am I doing wrong? Is there any way to reset that error value to zero?
Thank you all for your help.

**************************
ADDPRINTER.KIX
**************************
addprinterconnection("\\PrintServer\Admin")
addprinterconnection("\\PrintServer\Control-A")
addprinterconnection("\\PrintServer\Control-N")
addprinterconnection("\\PrintServer\Desk")
addprinterconnection("\\PrintServer\Library")
addprinterconnection("\\PrintServer\News Coordinator")
addprinterconnection("\\PrintServer\Operations")
addprinterconnection("\\PrintServer\Pod")
addprinterconnection("\\PrintServer\Specials")
addprinterconnection("\\PrintServer\Sports")
addprinterconnection("\\PrintServer\Studio-N")
addprinterconnection("\\PrintServer\Traffic")
addprinterconnection("\\PrintServer\HR")
? "A"
CALL "@LSERVER\netlogon\SetDefault.kix"
? "B"
exit
? "C"
**************************
SETDEFAULT.KIX
**************************
$Temp = SubStr($PrinterName,3,999)
? "1"
$PrinterServer = SubStr($Temp,1,InStr($TEMP,"\")-1)
? "2"
$PrinterShare = SubStr($Temp,InStr($TEMP,"\")+1,999)
? "3"
$RegKey = ",,"+$PrinterServer+","+$PrinterShare
? "4"

$Index = 0
? "5"
WHILE @ERROR = 0
? "6"
$ValueName = ENUMKEY("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment",$Index )
? "7"
If @ERROR = 0
? "8"
IF INSTR($Valuename,$RegKey) <> 0
? "9"
$PrinterType = SubStr($ValueName,InStr($ValueName," - "),999)
? "10"
$DeviceName = "\\"+$PrinterServer+"\"+$PrinterShare+$PrinterType+",winspool,Ne0"+$Index+":"
? "11"
SETDEFAULTPRINTER ("\\PRINTSERVER\"$PrinterType)

? "12"
ENDIF
ENDIF
$Index = $Index + 1
LOOP

:EndProgram

Top
#62941 - 2002-02-08 07:55 AM Re: Roaming Profiles - Default Printers - PLEASE HELP
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
answered to your post on starters forum.


cheers,

_________________________
!

download KiXnet

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 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.052 seconds in which 0.027 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