krugar77
asked on
How to install local printer with IP from .bat or .vbs for users who are not admins?
I was wondering if someone could lend me hand? I need to set a logon script that installs a local printer to a TCP/IP port for a few users. The below works great if they are admins. Problem is, only one of the people in the group are. Is there a way to specify an admin account for the command? Or is there a better way using a vbs script? Thanks in advance.
rundll32 printui.dll,PrintUIEntry /if /b "Back Office Printer" /f %windir%\inf\ntprint.inf /r "IP_10.0.0.1" /m "HP LaserJet 8100 Series PS" /z /u
rundll32 printui.dll,PrintUIEntry /if /b "Back Office Printer" /f %windir%\inf\ntprint.inf /r "IP_10.0.0.1" /m "HP LaserJet 8100 Series PS" /z /u
I use Kixtart scripts for my Windows 200x domains. Its very easy scripting language that is free. It is meant for creating logon scripts.
www.kixtart.org - examples, and download software to load on your DC's.
www.kixscripts.com - for script editor
If ADDPRINTERCONNECTION ("\\vleerbeer\hp laserjet 4") = 0
? "Added printer connection...."
Endif
-later
www.kixtart.org - examples, and download software to load on your DC's.
www.kixscripts.com - for script editor
If ADDPRINTERCONNECTION ("\\vleerbeer\hp laserjet 4") = 0
? "Added printer connection...."
Endif
-later
ASKER
Anyway to name them cohortq ?
ASKER
That didn't work cohortq... oh well
Hmm are you trying to connect directly to the printer via a jet direct port? If so I would recommend creating a TCP/IP local printer port for that printer on yer server. Its like Add Local printer, then select TCP/IP and like put in the ip of the printer I believe. You need to assign a share name to the printer on your server. Then you can do this.
'******START OF SCRIPT********
Set WshNetwork = CreateObject("WScript.Netw ork")
On Error Resume Next 'Ignores any errors
WshNetwork.AddWindowsPrint erConnecti on "\\SERVERNAME\PRINTERSHARE NAME"
On Error Resume Next
WshNetwork.SetDefaultPrint er"\\SERVE RNAME\PRIN TERSHARENA ME"
On Error Resume Next
'******END OF SCRIPT********
so SERVERNAME = Name of your PDC server to host the printer
PRINTERSHARENAME = name you gave when you shared the printer on the server
'******START OF SCRIPT********
Set WshNetwork = CreateObject("WScript.Netw
On Error Resume Next 'Ignores any errors
WshNetwork.AddWindowsPrint
On Error Resume Next
WshNetwork.SetDefaultPrint
On Error Resume Next
'******END OF SCRIPT********
so SERVERNAME = Name of your PDC server to host the printer
PRINTERSHARENAME = name you gave when you shared the printer on the server
ASKER
The other problem I have is that the majority of the people do not have local admin rights. How can I run the vbs script through group policy so that these users can install printers? Or is there a way from within the script to specify a user and password?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
From the group policy I believe yo ucan also enable the installation of printers as well. Hmm why dont you like just give them like administrative access, and then lock them down in the group policy. You can specify exactly what programs they can run, and you can restrict as much as you want. (also Im using the old group policy editor I know there is a new one that I hear is MUCH SIMPLER to use, and it is a free dl from microsoft)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Group Policy idea is good :-)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
'******START OF SCRIPT********
Set WshNetwork = CreateObject("WScript.Netw
On Error Resume Next 'Ignores any errors
WshNetwork.AddWindowsPrint
On Error Resume Next
WshNetwork.SetDefaultPrint
On Error Resume Next
'******END OF SCRIPT********
Copy this into notepad and rename the file into something like printer.vbs
This adds the printer to the computer, and then sets it as a default printer (if you want that) you don't have to you can just use it to connect the printer. Thing is that this needs to be run each time the user logs on. You cna set this in the user properties in active directory under login script. And you need to copy the vbs file in the scripts folder of the sysvol share on yer PDC. Plus, you need to have the printer dirvers installed on the server. I think it would be easier if you install this printer as a shared printer under the TCP/IP ports on yer server.