Jump to content

Recommended Posts

Posted

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's:public

neo

DM

 

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

 

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.

 

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

Posted

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.

Posted

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...