GPO to add printer?

Hello,

Can I use a GPO to install a printer via an AD group, but the printer is not on a printer server?  We have a warhouse where there are a few direct TCP/IP printers, but I want to install these on users PC's if they are in a certain AD group?

Thanks

March 26th, 2015 12:23pm

Yes, you can.

There is how to do:

GP preferences: add a new printer

or you can use logon script.

Free Windows Admin Tool Kit Click here and download it now
March 26th, 2015 12:33pm

So you can share the printer from someones PC and then use a GPO to map it to others, I guess their PC needs to be on at all times?
March 26th, 2015 12:37pm

Yes, or you can use logon script and you dont need running share at comp or server.

Script like this:

Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Temp\addprinter2.ok") Then
    Wscript.quit
Else
Set WSHNetwork = WScript.CreateObject("WScript.Network")
set shell = WScript.CreateObject( "WScript.Shell" )
CompName = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")
Set objWMIService = GetObject("winmgmts:\\" & CompName & "\root\cimv2")
    objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
Set oShell = WScript.CreateObject("WScript.shell")
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_

sub createPort (name, ip)
    objNewPort.Name = name
    objNewPort.Protocol = 1
    objNewPort.HostAddress = ip
    objNewPort.SNMPEnabled = False
    objNewPort.Put_
end sub

sub addPrinter (driver, port, name)
    objPrinter.DriverName = driver
    objPrinter.PortName = port
    objPrinter.DeviceID = name
    objPrinter.Location = ""
    objPrinter.Network = True
    objPrinter.Shared = false
    objPrinter.ShareName = ""
    objPrinter.Put_
end sub

createPort "IP_192.168.0.1", "192.168.0.1"
createPort "IP_192.168.0.2", "192.168.0.2"



'-------------------------------------------------'    Display name
'Install printers with externally defined drivers:'    for printer              Driver location                    Port name                  Driver name in .inf file
'-------------------------------------------------'    -----------       ---------------------------------         ------------               -----------------------  
oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b ""NRG DSm616 - 1.floor""    /f \\servername.domain.com\scripts$\drv\print\nrg616\OEMSETUP.inf   /r ""IP_192.168.0.1"" /m ""NRG DSm616 PCL 6"""  ,,true
oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b ""T644 Lexmark - 2.floor""    /f \\servername.domain.com\scripts$\drv\print\LMAAT2DA.inf   /r ""IP_192.168.0.2"" /m ""Lexmark T644"""  ,,true


Set objFile = objFSO.CreateTextFile("C:\Temp\addprinter2.ok", True)
objFile.WriteLine "Script run: " & date & " v " & time
objFile.Close
Wscript.sleep 10000
End if

Free Windows Admin Tool Kit Click here and download it now
March 26th, 2015 2:59pm

Wow, scripting is not my area at all, so what woud I save this as to run Thennet?

How would the script look if the printer was on IP address 192.168.100.16 and we wanted it to be called 'Sales-Copier' on everyones computer?

The printer is actually a copier, but we need to it to use HP Laserjet 4 drivers and be called 'Sales-Copier'

Is this possible?


  • Edited by TB303 Thursday, March 26, 2015 4:07 PM
March 26th, 2015 3:14pm

This script is save and tested, but of course test it on one computer. Better safe then sorry.

There is modified script:

Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Temp\addprinter.ok") Then
    Wscript.quit
Else
Set WSHNetwork = WScript.CreateObject("WScript.Network")
set shell = WScript.CreateObject( "WScript.Shell" )
CompName = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")
Set objWMIService = GetObject("winmgmts:\\" & CompName & "\root\cimv2")
    objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
Set oShell = WScript.CreateObject("WScript.shell")
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_

sub createPort (name, ip)
    objNewPort.Name = name
    objNewPort.Protocol = 1
    objNewPort.HostAddress = ip
    objNewPort.SNMPEnabled = False
    objNewPort.Put_
end sub

sub addPrinter (driver, port, name)
    objPrinter.DriverName = driver
    objPrinter.PortName = port
    objPrinter.DeviceID = name
    objPrinter.Location = ""
    objPrinter.Network = True
    objPrinter.Shared = false
    objPrinter.ShareName = ""
    objPrinter.Put_
end sub

createPort "IP_192.168.100.16", "192.168.100.16"


'-------------------------------------------------'    Display name
'Install printers with externally defined drivers:'    for printer              Driver location                    Port name                  Driver name in .inf file
'-------------------------------------------------'    -----------       ---------------------------------         ------------               -----------------------  
oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b ""Sales-Copier""    /f \\servername.domain.com\scripts$\drv\print\hp\prnhp001.inf   /r ""IP_192.168.100.16"" /m ""HP LaserJet 4"""  ,,true


Set objFile = objFSO.CreateTextFile("C:\Temp\addprinter.ok", True)
objFile.WriteLine "Script run: " & date & " and " & time
objFile.Close
Wscript.sleep 10000
End if
  1. Script first test if file c:\temp\addprinter.ok exist, if yes then quit, it is for prevent repeated install printer after restart when using same GPO. At the end of script writes file addprinter.ok to c:\temp.
  2. createPort is like adding printer using TCP/IP, just write your printer IP address.
  3. I use Rundll32 printui.dll,printuientry, if you want know more go to Rundll32 printui.dll,PrintUIEntry
  4. Just quick Display name = Sales-Copier, Driver location = \\servername.domain.com\scripts$\drv\print\hp\prnhp001.inf, you must put here correct UNC path to drivers files for printer and if you know something about INF, then you know that driver name in INF file ("HP LaserJet 4") is important for correct driver install, otherwise printer would not be recognized and portname = IP_192.168.100.16 is clear.

Test it and use it.

Best Regards

thennet



  • Edited by thennet Friday, March 27, 2015 7:36 AM
Free Windows Admin Tool Kit Click here and download it now
March 27th, 2015 6:29am

Hello & thanks,

Sorrry for the extra questions.

  1. This could be just what I need, so the path  \\servername.domain.com\scripts$\drv\print\hp\prnhp001.inf just needs to be a share location to the printers ini, but our computers have the hp laserjet 4 locally installed, can it not use that?
  2. What do do I save the file as?
  3. Do I just add to the GPO > users > prefs > windows settings > ini
March 27th, 2015 8:05am

ad 1) If you know driver path on local disk and path is same for all computers, you can use that.

ad 2) It is VBScript language (.vbs), save it for example installprint.vbs after do this, you can execute script on test client and test script(correct path driver, name printer, IP, test page, etc.)

ad 3) Add it to GPO > User Configuration> Policies > Windows Settings > Scripts > Logon, your Users must have privilege to install printers 

How to do:

Assign User Logon Scripts

Create System Startup / Shutdown and User Logon / Logoff Scripts

Regards

thennet

  • Edited by thennet Friday, March 27, 2015 10:01 AM
Free Windows Admin Tool Kit Click here and download it now
March 27th, 2015 10:01am

Thanks, can I run the script manually as a vbs before adding to a GPO?

I need to work out where the drivers are locatedtoo as these are 64bit pc's.

Thanks

March 27th, 2015 10:35am

Yes, you can save text file as .vbs and run it. You can run script at computers without using GPO.

You're welcome.

Free Windows Admin Tool Kit Click here and download it now
March 27th, 2015 10:45am

Hi Thennet,

Sorry for the delay on this I was on holiday.

I'm excited to test this script this week!

One thing, I need to use this on our Citrix 2012 R2 64bit servers, so when someone logs on they get a printer (They use Dell Wyse Thin terminals).

How can I locate the correct printer driver location (HP laserjet 4 driver), I believe it is local to the server rather than using a UNC?

oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b ""CAS""    /f \\servername.domain.com\scripts$\drv\print\hp\prnhp001.inf   /r ""IP_192.168.100.16"" /m ""HP LaserJet 4"""  ,,true

April 7th, 2015 10:48am

Hi,

by me is easiest way use UNC path, because you can be sure that users always have access to driver path and no one can delete driver files.

You can use local path, if you have drivers at server in folder, e.g. C:\Drivers\hp\prnhp001.inf, then just change path to:

oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b ""CAS""    /f C:\Drivers\hp\prnhp001.inf   /r ""IP_192.168.100.16"" /m ""HP LaserJet 4"""  ,,true

The only condition is, that users who log in to the server must have access to driver path and have read permission.

Here Rundll32 printui.dll,PrintUIEntry is description of parameters and examples.

____________________________________________________

For example:

To add a printer using the Add Printer wizard and using an .inf file, InfFile.inf, located on drive c: at InfPath, type:

rundll32 printui.dll PrintUIEntry /ii /f c:\InfPath\InfFile.inf

____________________________________________________

Regards,

thennet

Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 12:27pm

Hello,

I will use the UNC.

We have to use the HP Laserjet 4 driver (horrid) and the one off HPs site doesn't work well for us, but if I go into the a Windows 8 64bit or Windows 2012 64 bit server and install a printer and choose:

"The printer that I wand isn't isn't listed" > in the driver location choose Windows Update > and wait a few minutes I can then choose the HP Laserjet 4 driver and this always works.

I just need a way to extract this drive and put on a network path, is this possible?

April 7th, 2015 12:35pm

You can extract this driver, or you can download it from Microsoft Update Catalog:

http://catalog.update.microsoft.com/v7/site/Search.aspx?q=microsoft%20driver%20update%20for%20hp%20laserjet%204

Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 1:01pm

Let me take a look, 

I did find this location C:\Windows\System32\spool\drivers\x64\3

but I can only see a fiel called HPLJ4.BUD and HPLJ4.GPD are these any good?

April 7th, 2015 1:04pm

Download the Cabinet file Thinnet from that location, lot's of files within it, any idea on where I go from here?  No inf file though.
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 1:16pm

Here is how to find drivers installed for printer:

http://www.solveyourtech.com/how-to-see-all-of-the-printer-drivers-currently-installed-in-windows-7/

For install printer you need inf file and some other files, HPLJ4.GPD is this file. you can find files thats needed in inf file.

April 7th, 2015 1:30pm

If you download CAB file for architecture x64 ( Amd64) and unzip files, there is prnhp001.inf and folder amd64 which contain many files for many printers. Using prnhp001.inf locate needed files for HP LaserJet 4.
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 1:42pm

Thanks got the files Thinnet!

I have tis script below now, can I run manually to outside a GPO first on a user PC to test, if so how?

Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Temp\addprinter.ok") Then
    Wscript.quit
Else
Set WSHNetwork = WScript.CreateObject("WScript.Network")
set shell = WScript.CreateObject( "WScript.Shell" )
CompName = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")
Set objWMIService = GetObject("winmgmts:\\" & CompName & "\root\cimv2")
    objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
Set oShell = WScript.CreateObject("WScript.shell")
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
 
sub createPort (name, ip)
    objNewPort.Name = name
    objNewPort.Protocol = 1
    objNewPort.HostAddress = ip
    objNewPort.SNMPEnabled = False
    objNewPort.Put_
end sub
 
sub addPrinter (driver, port, name)
    objPrinter.DriverName = driver
    objPrinter.PortName = port
    objPrinter.DeviceID = name
    objPrinter.Location = ""
    objPrinter.Network = True
    objPrinter.Shared = false
    objPrinter.ShareName = ""
    objPrinter.Put_
end sub
 
createPort "IP_192.168.100.16", "192.168.100.16"
 
 
'-------------------------------------------------'    Display name
'Install printers with externally defined drivers:'    for printer              Driver location                    Port name            
      Driver name in .inf file
'-------------------------------------------------'    -----------       ---------------------------------         ------------               -----------------------  
oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b ""CAS""    /f \\svr-files\files\IT\resources\Printer_Drivers\HPLJ4\prnhp001.inf   /r ""IP_192.168.100.16"" /m ""HP LaserJet 4"""
  ,,true
 
 
Set objFile = objFSO.CreateTextFile("C:\Temp\addprinter.ok", True)
objFile.WriteLine "Script run: " & date & " and " & time
objFile.Close
Wscript.sleep 10000
End if


  • Edited by TB303 Tuesday, April 07, 2015 1:53 PM
April 7th, 2015 1:52pm

I did try and saves as a .vbs and ran on my PC and got the error:

Line 3

Char 1

Error invalid Character

code 800A0408

Source Microsoft VBscript compilation error

Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 1:57pm

First try core of script, whitout testing or creating a file, after then you can try whole script.

Set WSHNetwork = WScript.CreateObject("WScript.Network")
set shell = WScript.CreateObject( "WScript.Shell" )
CompName = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")
Set objWMIService = GetObject("winmgmts:\\" & CompName & "\root\cimv2")
    objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
Set oShell = WScript.CreateObject("WScript.shell")
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
 
sub createPort (name, ip)
    objNewPort.Name = name
    objNewPort.Protocol = 1
    objNewPort.HostAddress = ip
    objNewPort.SNMPEnabled = False
    objNewPort.Put_
end sub
 
sub addPrinter (driver, port, name)
    objPrinter.DriverName = driver
    objPrinter.PortName = port
    objPrinter.DeviceID = name
    objPrinter.Location = ""
    objPrinter.Network = True
    objPrinter.Shared = false
    objPrinter.ShareName = ""
    objPrinter.Put_
end sub
 
createPort "IP_192.168.100.16", "192.168.100.16"
 
 
'-------------------------------------------------'    Display name
'Install printers with externally defined drivers:'    for printer              Driver location                    Port name            Driver name in .inf file
'-------------------------------------------------'    -----------       ---------------------------------         ------------               -----------------------  
oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b ""CAS""    /f \\svr-files\files\IT\resources\Printer_Drivers\HPLJ4\prnhp001.inf   /r ""IP_192.168.100.16"" /m ""HP LaserJet 4""",,true
 
April 7th, 2015 2:10pm

Running the above foudn an error:

line 36

char 3

seems to be "  ,,true"

Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 2:15pm

Posible problem

Error invalid Character

code 800A0408

, solution is here:

http://stackoverflow.com/questions/2039104/vbscript-invalid-character-800a0408-compilation-error

April 7th, 2015 2:17pm

you have  ,,true on second line, it must be at one line with 

oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /

like here:

oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b ""CAS""    /f \\svr-files\files\IT\resources\Printer_Drivers\HPLJ4\prnhp001.inf   /r ""IP_192.168.100.16"" /m ""HP LaserJet 4""",,true		
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 2:20pm

Closer, but I got this error

, if I install manualy and point to \\svr-files\files\IT\resources\Printer_Drivers\HPLJ4\prnhp001.inf I get further but still an error, so close!

Order 1

next error on next post


  • Edited by TB303 Tuesday, April 07, 2015 2:36 PM
April 7th, 2015 2:34pm

then 

order 2

Order 3




  • Edited by TB303 Tuesday, April 07, 2015 2:37 PM
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 2:35pm

I can browse to the prnhp001.inf file with no issues and open and browse to the printer:

;
; Windows Inbox Printer Drivers
;
[Version]
Signature="$Windows NT$"
Provider="Microsoft"
ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
Class=Printer
CatalogFile=prnhp001.cat
DriverVer=06/21/2006,6.1.7233.0


[Manufacturer]
"HP"=HP,NTamd64

[HP.NTamd64]
"HP LaserJet 4"                    = HPLJ4.GPD,Hewlett-PackardHP_La185F,HP_LaserJet_4 ; Hardware ID

  • Edited by TB303 Tuesday, April 07, 2015 2:48 PM
April 7th, 2015 2:46pm

When you install printer manualy, you have removed some files from Amd64 folder?
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 3:09pm

Check permission to driver files, e.g. HPLJ4.GPD, can you access it?
April 7th, 2015 3:13pm

It look like installer have access to prnhp001.inf, but can't access driver files in Amd64.
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 3:18pm

I will check. All I have done is downloaded that cab file, opened it up and copied the files to a folder where this server has access too.
April 7th, 2015 3:57pm

For testing driver files try install printer on test PC from local folder with drivers. If you installed it without error, then is problem with permissions at shared folder on server.
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 4:17pm

I have better news, those drivers worked on my Windows 7 64bit PC, but not via the 2012 server, so I manually installed the drivers on the server and copied the HP4 drivers it install via the windows update into the folder I point to and the print installs via the shorterned script :)

Howerver the full scripts doesn't

When I try to run the basic shorter script from a Citrix session manually I get this:


  • Edited by TB303 Wednesday, April 08, 2015 9:20 AM
April 8th, 2015 9:08am

For first error with full script try this:

  1. Open the .vbs in notepad
  2. Go to file and "save as"
  3. Right under the file name box, you will see a drop down menu for encoding. Choose ANSI.

For second error on Citrix session:

  • Instead these lines:

    Set objWMIService = GetObject("winmgmts:\\" & CompName & "\root\cimv2")
        objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True

  • Paste these lines and try it:

Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate, (LoadDriver)}!\\" & CompName & "\root\cimv2")

Free Windows Admin Tool Kit Click here and download it now
April 8th, 2015 10:42am

Yeah that worked, I guess I need the rest of the script to work now.  Very clever.

The big issue I have noticed is the printer needs to be installed in a user context mode, it seems to install the printer in the users session, but I have noticed the printer also gets installed on the actual Citrix server.

I'm not sure if you have used Citirx before, but it is clever and pulls though your local desktop printers into your Citrix session, these can be locally attached or network printers.

April 8th, 2015 12:54pm

The big issue I have noticed is the printer needs to be installed in a user context mode, it seems to install the printer in the users session, but I have noticed the printer also gets installed on the actual Citrix server.

I'm not sure if you have used Citirx before, but it is clever and pulls though your local desktop printers into your Citrix session, these can be locally attached or network printers.

No, I have never used Citrix, but it is similiar functionality like at Remote Desktop at Windows.

Your first question was:

Hello,

Can I use a GPO to install a printer via an AD group, but the printer is not on a printer server?  We have a warhouse where there are a few direct TCP/IP printers, but I want to install these on users PC's if they are in a certain AD group?

Answer is, if you have printer, which is not installed and shared on some computer and you want install this printer on more than one PC in domain, you can use this script. 

Now just run full script, for prevent repeating install printer.

I think it was a good workout for you in scripting :-)

Best Regards,

thennet

Free Windows Admin Tool Kit Click here and download it now
April 8th, 2015 1:35pm

No you are right, I have widened the original requests as I didn't want to over complicate things.

I did just delete the printer and logged back in and got this, but I will continue to test

April 8th, 2015 1:39pm

Also what should the full script look like as I know it has been changed somewhat?
Free Windows Admin Tool Kit Click here and download it now
April 8th, 2015 1:41pm

Don't think it liked the second line:

Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate, (LoadDriver)}!\\" & CompName & "\root\cimv2")

April 8th, 2015 2:44pm

Don't think it liked the second line:

Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate, (LoadDriver)}!\\" & CompName & "\root\cimv2")

OK, we can change this two lines to:

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate, (LoadDriver)}")

Also what should the full script look like as I know it has been changed somewhat?

To get full script, you need to top a script add these bold lines:

Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Temp\addprinter.ok") Then
    Wscript.quit
Else

Set WSHNetwork = WScript.CreateObject("WScript.Network")

and to end a script add these bold lines:

oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry ........

Set objFile = objFSO.CreateTextFile("C:\Temp\addprinter.ok", True)

objFile.WriteLine "Script run: " & date & " and " & time

objFile.Close
Wscript.sleep 10000
End if


Free Windows Admin Tool Kit Click here and download it now
April 9th, 2015 6:09am

Hello,

I've removed the 2 lines and added

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate, (LoadDriver)}")

I'm afraid I get the error:

The script looks like this

Set WSHNetwork = WScript.CreateObject("WScript.Network")
set shell = WScript.CreateObject( "WScript.Shell" )
CompName = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate, (LoadDriver)}")
Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
Set oShell = WScript.CreateObject("WScript.shell")
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
 
sub createPort (name, ip)
    objNewPort.Name = name
    objNewPort.Protocol = 1
    objNewPort.HostAddress = ip
    objNewPort.SNMPEnabled = False
    objNewPort.Put_
end sub
 
sub addPrinter (driver, port, name)
    objPrinter.DriverName = driver
    objPrinter.PortName = port
    objPrinter.DeviceID = name
    objPrinter.Location = ""
    objPrinter.Network = True
    objPrinter.Shared = false
    objPrinter.ShareName = ""
    objPrinter.Put_
end sub
 
createPort "IP_192.168.100.16", "192.168.100.16"
 
 
'-------------------------------------------------'    Display name
'Install printers with externally defined drivers:'    for printer              Driver location                    Port name            Driver name in .inf file
'-------------------------------------------------'    -----------       ---------------------------------         ------------               -----------------------  
oshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b ""CAS""    /f \\svr-fileserver\files\IT\resources\Printer_Drivers\HP\HPLJ4\prnhp001.inf   /r ""IP_192.168.100.16"" /m ""HP LaserJet 4""",,true

April 9th, 2015 9:40am

We must back to the previous code:

Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate, (LoadDriver)}!\\" & CompName & "\root\cimv2")

Test it.

Free Windows Admin Tool Kit Click here and download it now
April 10th, 2015 2:17am

Now says:

error

Line 4

Char 42

Error expected ")"

So I added this

Set objWMIService = GetObject("winmgmts:")
 _ & "{impersonationLevel=impersonate, (LoadDriver)}!\\" & CompName & "\root\cimv2")

and now get

error

Line 5

Char 4

Error invalid car

April 10th, 2015 3:15am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics