Logon script to map printers to people in specified OU's
Posted on 2004-11-02
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.
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.
Set objNet = CreateObject("Wscript.Network")
' Forces script to skip errors (rem below line to see errors)
on error resume next
Set WshNetwork = WScript.CreateObject("WScript.Network")
' all drives to be removed here are set here.
'all drives to be mapped are set here.
objNet.MapNetworkDrive "H:", "\\FS01\MIS111"
objNet.MapNetworkDrive "Q:", "\\FC01\ETIME"
objNet.MapNetworkDrive "F:", "\\SOH\SYS"
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"