• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

Logon script to map printers to people in specified OU's

Any help or suggestions will be much appriciated because i am new to scripting.  Here is my problem.  I have 25 XP machines in an OU called StandaloneXP.  I have a group policy applied to the computers in this OU so that all users who log on to these machines will have the policy applied to them.  Users who log into these machines belong to different departments - I have all my users in seperate OU's by department.  I want to create a VBScript so that when a user logs onto one of the XPMachines it will map certain printers by which department OU the user is in.  

For instance:

When user in finance department(finance OU) logs on to XPMAchine they need to have 8 finance printers mapped when they logon.

When user in hr department (HumanResources OU) logs on they need to have 4 HR printers mapped etc etc etc....

****Now i know i can add the script to each Department OU and script the printers like that.  But i run a mixed envirnoment where some users have 2000/xp client machines and others run thin client  - citrix.  Some users use both so i want to keep the script contained to the StandAloneXP OU where all the Xp computers are.  

I am new to scripting so I am pasting a copy of the script i wrote to map drives and printers.  I would like to add or change this around so i can do what i have explained above.  This script basically only maps the finance printers for everyone that logs into the XPMachines.  

Dim objNet
Set objNet = CreateObject("Wscript.Network")
' Forces script to skip errors (rem below line to see errors)
on error resume next

Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
' all drives to be removed here are set here.
WshNetwork.RemoveNetworkDrive "H:"
WshNetwork.RemoveNetworkDrive "Q:"
WshNetwork.RemoveNetworkDrive "F:"
'all drives to be mapped are set here.
objNet.MapNetworkDrive "H:", "\\FS01\MIS111"
objNet.MapNetworkDrive "Q:", "\\FC01\ETIME"
objNet.MapNetworkDrive "F:", "\\SOH\SYS"

Dim net
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\LIHFS01\FINANCE_4", "FINANCE_4"
net.AddWindowsPrinterConnection "\\LIHFS01\FINANCE_9", "FINANCE_9"
net.AddWindowsPrinterConnection "\\LIHFS01\FINANCE-2", "FINANCE_2"
net.AddWindowsPrinterConnection "\\LIHFS01\FINANCE--2", "FINANCE_22"
net.AddWindowsPrinterConnection "\\LIHFS01\FINANCE-3", "FINANCE_3"
net.AddWindowsPrinterConnection "\\LIHFS01\FINANCE-6", "FINANCE_6"
net.AddWindowsPrinterConnection "\\LIHFS01\FINANCE-8", "FINANCE_8"
 

0
GPEARL383
Asked:
GPEARL383
1 Solution
 
David LeeCommented:
Take a look at this previous EE question that addresses the same issue.
http://www.experts-exchange.com/Networking/WinNT_Networking/Q_20868659.html

Pay attention to the post from stablerm Date: 02/02/2004 11:49AM EST
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now