Petri IT Knowledgebase Forums
 

Petri.co.il forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri IT Knowledgebase Forums > Windows Scripting > General Scripting
Petri.co.il is happy to award auglan the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri IT Knowledgebase Forums Search Todays Posts Today's Posts Mark Forums Read

Notices

Printer.mapping.based.on.computer.group.

Printer.mapping.based.on.computer.group.

this thread has 1 replies and has been viewed 5676 times

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 30th July 2004, 07:28
azmantek's Avatar
MVM azmantek azmantek is offline
Junior Member
MVM
 
 Join Date: Jun 2004
  6 month star 12 month star
 Location: Houston,TX
 Posts: 182
 Reputation: azmantek has a spectacular aura aboutazmantek has a spectacular aura about (180)
Default Printer.mapping.based.on.computer.group.

Hi,

Situation:

Windows2003 domain, XP clients and I have 10 computer labs.
The way I name the computers in each lab is:
Lab01-01, Lab01-02, Lab01-03...

Lab02-01, Lab02-02, Lab02-03...
...
Lab10-01, Lab10-02, Lab10-03...

I have an OU (computer acct ) for each computer lab
OU: Lab01,.Lab02...Lab10.
Each lab has one printer. I'd like to run vbscript to map the printer for user
based on which lab that they are in.

Please help. Thanks!

P.S

This is what I learn from Mark Minasi book but it doesn't apply to my situation. It only applies for couple of computers

Option Explicit

Dim oNetwork, sPrintPath

Set oNetwork = CreateObject("WScript.Network")

Select Case oNetwork.ComputerName

Case "pc01"
sPrintPath = "\\printsvr\printer1"

Case " pc02"
sPrintPath = "\\printsvr\printer2"
End Select

oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath
Set oNetwork = vbEmpty
Set sPrintPath = vbEmpty
  #2  
Old 24th September 2004, 15:07
core core is offline
Casual
Casual
 
 Join Date: Sep 2004
  6 month star 12 month star
 Posts: 2
 Reputation: core is on a distinguished road (10)
Default hey

Ok add to login script or GPO this script

Name each printer printerXX

where XX define number of printer ( 01,02,03..)

and add this small and simple script :

Code:
Set objNetwork = Wscript.CreateObject("Wscript.Network")

sPrintPath = "\\printsvr\printer"  & Mid(objNetwork.ComputerName ,4, 2)

objNetwork.AddWindowsPrinterConnection sPrintPath 
objNetwork.SetDefaultPrinter sPrintPath 

Set oNetwork = vbEmpty 
Set sPrintPath = vbEmpty

Enjoy !
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +3. The time now is 07:50.

Steel Blue 3.5.4 vBulletin Style ©2006 vBEnhanced
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
 

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri