OK hello and everything. I would like to be able to map printers to certain computers based on their department which is an OU in AD, e.g english
Here is the script I have at present and it isn't quite coming off how I'd prefer. What is it thats going wrong?
PS. I'm actually a student who is interested in networks and this is a wee server I set up at home to mimic the one at my school.
I've got profiles, shares and re-directed desktops all sorted and working, but I for the life of me, can not get this script to pull off.
So I can give details here:
Servername:jonnyserv
OU'sublic
neo
DM
But its acting rather awkwardly, in that only some usuers actualy recieve the printers, another gets hp 2000c 1+2 when they should only recieve 3, and most get nothing, and another gets hp 2000c3 wherever they go.Code:set objSysInfo = CreateObject("ADSystemInfo") strComputerDN = lcase(objSysInfo.ComputerName) intStart=InStr(strComputerDN,"ou=") if intStart <> 0 then intEnd=InStr(intStart,strComputerDN,",") strOU = mid(strComputerDN,intStart,intEnd) Set objNetwork= CreateObject("WScript.Network") select case lcase(strOU) case "ou=public" objNetwork.AddWindowsPrinterConnect "\\jonnyserv\hp 2000c 1" objNetwork.AddWindowsPrinterConnect "\\jonnyserv\hp 2000c 2" objNewwork.SetDefaultPrinter "\\jonnyserv\hp 2000c 1" case "ou=neo" objNetwork.AddWindowsPrinterConnect "\\jonnyserv\hp 2000c 3" objNewwork.SetDefaultPrinter "\\jonnyserv\hp 2000c 3" end select end if
Could it also be down to me using preconfigured profiles, I ave done those with all users but kept the .dat extension so settings are saved, would changing it to .man and apply that then remove the printers from the profile at logoff as .man doesnt save settings.In other words, the printers are sticking to the users profile.
I made a new user with no pre-configured profile and it only recieves hp 2000c 1+2 regardless of which PC they log into
Hope this all makes sense thnx

If you do a search there are member-contributed scripts that do just this. You might find it easy to use one of these than troubleshoot your existing one.
It is also worth removing any existing printers at logon, before the assignment of the new ones... that is what other people tend to do - I use a script tat selects the printer in a case statement because OUs are not a suitable way for selecting printers for me.
Windows 2003 Server R2 has printer installation via group policy. It doesn't handle setting default printers very well (no way of setting it within group policy, so it just picks the last printer on the PC (alphabetically)). It can also have some problems for users in mutiple groups.
More information can be found here.
I would use Ric_'s script mate, link to thread below.
http://www.edugeek.net/index.php?nam...iewtopic&t=404
Its really easy to setup, you can setup defaults, and its easily changed if a printer goes down etc.
Not had any problems with missing printers or wrong defaults. Thanks Ric_
There are currently 1 users browsing this thread. (0 members and 1 guests)