Jump to content

How to add IP printer to active directory


tagwar

Recommended Posts

Hi expert people

I have question

I want to add IP printer to the active directory

I am going to active directory users and computers and trying to add the printer

But it ask me for network path like “\\server\share”

I try to put printer IP address but it’s not accepting it

Can anyone tell me what is the best way to add this printer to the domain

The reason to add this printer to the domain is to make it the defult printer via login script

the printer is accisable throw the network but i want to add it to the AD

I hope to find the solution in your experience

Link to comment
Share on other sites

  • 4 weeks later...

There are ways to achieve this via vbscript, but the easiest method would be to install the printer on the server and then you can use the \\server\printer method in AD

i already did this

but it didn't come for the users.

also the script i tyied and also dosn't work.

i don't know may i do something wrong.

Link to comment
Share on other sites

Run as a user login script:

strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

set objNewPort = objWMIService.get("Win32_TCPIPPrinterPort").SpawnInstance_
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objDriver = objWMIService.Get("Win32_PrinterDriver")

'Replace FRIENDLYNAME with the Friendly name or Display name of your printer
Set colInstalledPrinters = objWMIService.ExecQuery ("Select * from Win32_Printer Where Name = 'FRIENDLYNAME'")

For Each objPrinter in colInstalledPrinters
objPrinter.SetDefaultPrinter()
Next

Installing IP printers:

strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

set objNewPort = objWMIService.get("Win32_TCPIPPrinterPort").SpawnInstance_
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objDriver = objWMIService.Get("Win32_PrinterDriver")


'Install printer where driver is already installed on system
'Laserjet 4200
'Installs Printer Driver
objDriver.Name = "HP LaserJet 4200 PS" ' Name as displayed in the driver INF
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
intResult = objDriver.AddPrinterDriver(objDriver)

'Installs Printer Port
objNewPort.Name = "IPADDRESSorFQDNofPRINTER" 'Replace with the FQDN or IP address to the printer
objNewPort.Protocol = 1
objNewPort.HostAddress = "IPADDRESSorFQDNofPRINTER" 'Replace with the FQDN or IP address to the printer
objNewPort.PortNumber = 9100 ' replace with appropriate port number 9100 seems to be default
objNewPort.SNMPEnabled = True
objNewPort.Put_

'Install Printer
objPrinter.DriverName = "HP LaserJet 4200 PS" ' Name as displayed in the driver INF
objPrinter.PortName = "IPADDRESSorFQDNofPRINTER" ' Replace with the FQDN or IP address to the printer
objPrinter.DeviceID = "FRIENDLYNAME" ' Replace with the name you want displayed in the control panel
objPrinter.Location = ""
objPrinter.Network = True
objPrinter.Put_

'Laserjet 4250
'Installs Printer Driver for printer with driver not already installed
objDriver.Name = "HP LaserJet 4250 PS" ' Name as displayed in the driver INF
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
intResult = objDriver.AddPrinterDriver(objDriver)

'Installs Printer Port
objNewPort.Name = "IPADDRESSorFQDNofPRINTER" ' Replace with the FQDN or IP address to the printer
objNewPort.Protocol = 1
objNewPort.HostAddress = "IPADDRESSorFQDNofPRINTER" ' Replace with the FQDN or IP address to the printer
objNewPort.PortNumber = 9100 '' replace with appropriate port number 9100 seems to be default
objNewPort.SNMPEnabled = True
objNewPort.Put_

'Install Printer
objPrinter.DriverName = "HP LaserJet 4250 PS" ' Name as displayed in the driver INF
objPrinter.PortName = "IPADDRESSorFQDNofPRINTER" ' Replace with the FQDN or IP address to the printer
objPrinter.DeviceID = "FRIENDLYNAME" ' Replace with the name you want displayed in the control panel
objPrinter.Location = ""
objPrinter.Network = True
objPrinter.Put_
objPrinter.SetDefaultPrinter()

Link to comment
Share on other sites

  • 1 month later...

I've been trying many different scripts to add printers as a logon script, but this one actuall worked.

Now I have one question.

Where is it getting the printer drivers from?

I've tested the script on a computer that DID NOT have the printer driver already installed, and it still mapped and printed a test page, so now im curious as to where it gets them from before i add the user scripts to my policy.

Thanks.

Link to comment
Share on other sites

If it truely does not exists on the system already it should not have installed. Unless you are printer to a print server, then it will download them from the print server.

In the two examples I have in the script one installs an HP 4200 which XP already has in the driver database. The second is a 4250 which is not in the driver database and it installs the driver as part of the install and you tell it where to find the drivers at.

Link to comment
Share on other sites

I've been trying many different scripts to add printers as a logon script, but this one actuall worked.

Now I have one question.

Where is it getting the printer drivers from?

I've tested the script on a computer that DID NOT have the printer driver already installed, and it still mapped and printed a test page, so now im curious as to where it gets them from before i add the user scripts to my policy.

Thanks.

can you explain what you did Exactly???

Link to comment
Share on other sites

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...