Page 1 of 2 12>
Topic Options
#163040 - 2006-06-07 01:41 PM Printer Location Tracking
Sypher Offline
Fresh Scripter

Registered: 2005-11-18
Posts: 9
Hello,

I am running a couple of Win2k3 (Enterprise) servers. One of this server is hosting all the printers (100 to be exact). These 100 printers all have names like AMS-PR1 to AMS-PR188 (only the uneven numbers are on this server).

All the printers have a department in their Location (Sales, Development etc..), and the Locationname in the Descripting (Amsterdam)

I'm using KiX as a logon script, but now theres a thing i can't seem to fix.

What i want to do is adding a printer to a user, but only a printer in his own group (e.g. Sales).. One of the random printers in the department..

Is there a way to do this with KiX?

I hope to hear from you soon, Thanks in advance!

Top
#163041 - 2006-06-08 02:58 AM Re: Printer Location Tracking
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hello and Welcome to the board.

Yes it can be done, but why would you want to install a "random" printer even from a specified group?

What version of KiXtart are you using and what are you desktop OS that are in use that need to be supported.

Top
#163042 - 2006-06-08 10:34 AM Re: Printer Location Tracking
Sypher Offline
Fresh Scripter

Registered: 2005-11-18
Posts: 9
Hello, First of all, thanks for the reply.
I am running the latest version of KiX (as always). My workstations are all running under Windows XP SP2.

Here's a picture of my network:
- 2 Fileservers with printers spread (uneven = FS1, even = FS2)
- 100 printers per fileserver
- 10 departments (Administration, Aftersales, Transport, Management, Communication, Development, Sales, Marketing, Helpdesk, Sysop)

- All the printers have a location (the departmentname)

Now i have to connect the closest printer, thus one in the office of the department, e.g. Sales..

I hope this clears up any questions

--
Edit:

I guess theres also another "quick 'n dirty" solution, to check what group the user is in, and then add a random printer out the scope (For example: AMS-PR155 - AMS-PR165) but i'd like to use the Location-field)


Edited by Sypher (2006-06-08 10:38 AM)

Top
#163043 - 2006-06-12 08:51 AM Re: Printer Location Tracking
Sypher Offline
Fresh Scripter

Registered: 2005-11-18
Posts: 9
Any suggestions?
Top
#163044 - 2006-06-12 09:32 AM Re: Printer Location Tracking
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
See if this thread helps...
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB13&Number=112039
_________________________
(... better days ahead)

Top
#163045 - 2006-06-12 09:35 AM Re: Printer Location Tracking
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well if you want to read the description field then you can check out one of the WMI Printer Scripts and see if it gives you the details you want. If not then you can create your own if it's supported.

If InGroup('Sales') And WMIcode or registry code to read description, Map Printer.

You could also maybe fill out an INI file to read the wanted information and do an Ingroup call.

A few ways to do it. Do you need actual code examples or are you reasonably familiar with KiX to do it?

Top
#163046 - 2006-06-12 11:05 AM Re: Printer Location Tracking
Sypher Offline
Fresh Scripter

Registered: 2005-11-18
Posts: 9
I used kix before, but im not that experienced.. Some examples (especially the WMI stuff) are very welcome

Edit:
I found some code like:
Code:

Option Explicit
Dim objWMIService, objItem, colItems, strComputer, intPrinters

strComputer ="."
intPrinters = 1

Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery _
("SELECT * FROM Win32_Printer")

Call Wait() ' Goto Sub Routine at the end

' On Error Resume Next
For Each objItem In colItems
WScript.Echo "Location: " & objItem.Location & " Shared as: \\" & objItem.ShareName
intPrinters = intPrinters + 1
Next

sub Wait()
If strComputer = "." then
strComputer = "Local Host"
else strComputer = strComputer
end if

End Sub

WScript.Quit



But how can this be ported to KiX?


Edited by Sypher (2006-06-12 12:54 PM)

Top
#163047 - 2006-06-15 12:56 PM Re: Printer Location Tracking
Sypher Offline
Fresh Scripter

Registered: 2005-11-18
Posts: 9
Sorry to bump this topic, i really need this
Top
#163048 - 2006-06-15 02:03 PM Re: Printer Location Tracking
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
What OS are the clients running?
_________________________
(... better days ahead)

Top
#163049 - 2006-06-15 02:13 PM Re: Printer Location Tracking
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:


....
My workstations are all running under Windows XP SP2.
....



_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#163050 - 2006-06-15 02:16 PM Re: Printer Location Tracking
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Al,

My guess is that he wants to do a double check.

1. Check if user is a member of a certain group
2. Check the "description field of the shared printer for a specific phrase"


If InGroup("x") And (Description contains x) EndIf

At least that's how I read it.

The issue would be how to get that shared phrase either from the registry or from WMI

Top
#163051 - 2006-06-15 02:21 PM Re: Printer Location Tracking
Sypher Offline
Fresh Scripter

Registered: 2005-11-18
Posts: 9
Well checking groups isn't the problem, checking the printer properties is.. I've searched the forum but i couldn't find any printer querying.

I do have a VBscript (as you can see a few posts up) that gives the location of the printer and the sharename...

Top
#163052 - 2006-06-23 04:21 PM Re: Printer Location Tracking
Sypher Offline
Fresh Scripter

Registered: 2005-11-18
Posts: 9
^^ kick ^^

Please?

Top
#163053 - 2006-06-23 04:52 PM Re: Printer Location Tracking
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Sypher,

Does this help?
Code:

Dim $objWMIService, $objItem, $colItems, $strComputer, $intPrinters
$strComputer="."
$intPrinters=1

$objWMIService=GetObject("winmgmts:\\"+$strComputer+"\root\CIMV2")
$colItems=$objWMIService.ExecQuery("SELECT * FROM Win32_Printer")

?"Looking at Printers installed on: "+@wksta
For Each $objItem In $colItems
IF LEN($objItem.Location)>3
?"Location: "+$objItem.Location+" Shared as: \\"+$objItem.ShareName
$intPrinters=$intPrinters+1
ENDIF
Next
?'Process is complete'
get $



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

Top
#163054 - 2006-06-23 04:58 PM Re: Printer Location Tracking
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Well, a fairly direct translation losing the wooly bits is:
Code:
Dim $objWMIService, $objItem, $colItems, $strComputer

$strComputer ="."

$objWMIService = GetObject("winmgmts:\\" + $strComputer + "\root\CIMV2")
$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Printer")

For Each $objItem In $colItems
"Location: '" + $objItem.Location + "' shared as: \\" + $objItem.ShareName+@CRLF
Next

Exit 0


Top
#163055 - 2006-06-26 10:31 PM Re: Printer Location Tracking
Sypher Offline
Fresh Scripter

Registered: 2005-11-18
Posts: 9
Well as far as i can understand it, it looks like it'll work. Now the point is to randomly select one of the printers that match the user group (which is named G_Groupname) and bind it to the user...
Top
#163056 - 2006-06-27 12:12 AM Re: Printer Location Tracking
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I don't get this random bit. What are users supposed to do, check all the printers to see which one they won in the lottery?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#163057 - 2006-06-27 12:40 AM Re: Printer Location Tracking
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
My geuss was that he is trying to do a "printer pool" type thing. Having a bunch of printers in one location and making sure that everyone does not connect to the same one.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#163058 - 2006-06-27 02:23 AM Re: Printer Location Tracking
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Would it not be better to setup printer pooling on the printserver? I mean, the server knows which printer is available at the moment the job is submitted. A logon script that picks a random printer at logon makes no sense. Smells like a supervisor brainfart.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#163059 - 2006-06-27 02:58 AM Re: Printer Location Tracking
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
I agree, but we don't know the circumstances and you are most likely correct with the
Quote:

Smells like a supervisor brainfart.


_________________________
Today is the tomorrow you worried about yesterday.

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

Generated in 0.807 seconds in which 0.173 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