Scripts Thread, logon script for printer in Coding and Web Development; Any help would be recieved with open arms!!!!
Just put the following logon script to map a printer in a ...
-
22nd November 2007, 01:36 PM #1 logon script for printer
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.
-
-
IDG Tech News
-
22nd November 2007, 01:40 PM #2 Re: logon script for printer
Is the other user you have added a memebr Domain Admin security group?
Also check the security filtering on the GPO
-
-
22nd November 2007, 02:19 PM #3 Re: logon script for printer
Also check out http://edugeek.net/index.php?name=Fo...iewtopic&t=404 for lots of info on this (and a ready made script that works!)
-
-
22nd November 2007, 02:54 PM #4
- Rep Power
- 14
Re: logon script for printer
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(strConnectS tring)
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.
-
-
22nd November 2007, 03:33 PM #5 Re: logon script for printer
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"
-
-
22nd November 2007, 03:56 PM #6 Re: logon script for printer
Use Ric_'s script, we have been using it here and it does the job perfect, not had one problem.
Cheers Ric_ :-)
-
-
22nd November 2007, 04:03 PM #7 Re: logon script for printer
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.
-
SHARE:
Similar Threads
-
By _Bat_ in forum Windows
Replies: 8
Last Post: 25th February 2009, 10:50 AM
-
By Galway in forum Windows
Replies: 3
Last Post: 29th August 2007, 11:00 AM
-
By ninjabeaver in forum How do you do....it?
Replies: 16
Last Post: 24th August 2007, 12:49 PM
-
By ajbritton in forum Windows
Replies: 3
Last Post: 19th June 2006, 09:47 AM
-
By tarquel in forum Windows
Replies: 37
Last Post: 14th June 2006, 09:07 AM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules