ozzy Posted November 22, 2007 Posted November 22, 2007 Any help would be recieved with open arms!!!! Just put the following logon script to map a printer in a OU GPO that I have been using to test policys before deploying them to a new domain, it worked fine with test user account but when I added another user to the OU nothing!!!! Set objNetwork = CreateObject("WScript.Network") objNetwork.AddWindowsPrinterConnection "\\europa\itlaser" objNetwork.SetDefaultPrinter "\\europa\itlaser" any ideas, PLEASE.
djm968 Posted November 22, 2007 Posted November 22, 2007 Is the other user you have added a memebr Domain Admin security group? Also check the security filtering on the GPO
Ric_ Posted November 22, 2007 Posted November 22, 2007 Also check out http://edugeek.net/index.php?name=Forums&file=viewtopic&t=404 for lots of info on this (and a ready made script that works!)
Halfmad Posted November 22, 2007 Posted November 22, 2007 This is the printer script I use, adds the printer depending on the OU the computer in, rather than the user. Works great in here, add printer to server, add it to script, job done, it'll add itself to any computers in that department from then on. Created with help from EDUGeek chaps: on error resume next 'Set variables. Set shell= WScript.CreateObject("WScript.Shell") Set WshNetwork = WScript.CreateObject("WScript.Network") dim Counter, PrinterPath Set objWshNetwork = CreateObject("WScript.Network") Set objAdsSystemInfo = CreateObject("adsysteminfo") Set objComputerName = GetObject("LDAP://" & objAdsSystemInfo.ComputerName) Set objOU = GetObject(objComputerName.Parent) strOU = replace(objOU.Name,"OU=","") Set oPrinters = WshNetwork.EnumPrinterConnections Dim computerName computerName = LCase(WshNetwork.ComputerName) 'Add printers depending on AD OU containing computer. Select Case strOU Case "IT1" removePrinters addPrinter "\\print\Dell1700 IT1",True addPrinter "\\print\HP2500C IT1",False Case "IT2" ' removePrinters addPrinter "\\print\HP LJ P2015n IT2",True end select function removePrinters() FOR Counter = 0 to oPrinters.Count - 1 IF mid(oPrinters.Item(Counter), 1, 2) = "\\" THEN PrinterPath = oPrinters.Item(Counter) WshNetwork.RemovePrinterConnection PrinterPath, True, True end if next end function function addPrinter(strConnectString,isDefault) if strConnectString <> "" then strResult = WshNetwork.AddWindowsPrinterConnection(strConnectString) if isDefault then WshNetwork.SetDefaultPrinter strConnectString end if end if end function ============ The true/false statements after the printer name dictate whether it's set as default or not. "removeprinters" only removes network and not local printers.
Guest aliv25 Posted November 22, 2007 Posted November 22, 2007 Here is an example of a script we use for the LRC. Note: The word school refers to the name of your server you use at your place. rem ** Next line must not be deleted ** Set WshNetwork = CreateObject("WScript.Network") rem ** This will delete existing printers ** On Error Resume Next Set oPrinters = WshNetwork.EnumPrinterConnections For i = 1 to oPrinters.Count - 1 Step 2 WshNetwork.RemovePrinterConnection oPrinters.Item(i) Next rem ** Setup new printer connection ** WshNetwork.AddWindowsPrinterConnection "\\SchoolPrint.School.local\LRC" rem ** Setup default printer ** WshNetwork.SetDefaultPrinter "\\SchoolPrint.School.local\LRC" MsgBox "Added Printer: LRC. This printer is default"
mullet_man Posted November 22, 2007 Posted November 22, 2007 Use Ric_'s script, we have been using it here and it does the job perfect, not had one problem. Cheers Ric_ :-)
mrforgetful Posted November 22, 2007 Posted November 22, 2007 We use the R2 functionality of Server 2003 R2. Before that I ran a script on the computer itself after imaging which would add the printer for anyone who logged on.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now