Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Printer Driver remote installation fail ???

8 réponses
Avatar
Jo
Hello,

I try to install remotely a printer driver on a Server2003.

My code is:

if WmiConnect(strServer, kNameSpace, strUser, strPassword,
oService) then
set oDriver = oService.Get("Win32_PrinterDriver")
oDriver.Name = "hp LaserJet 1320 PCL 6"
oDriver.SupportedPlatform = "Windows NT x86"
oDriver.Version = "3"
oDriver.FilePath = "C:\Drivers\HP\LaserJet
1320n"
oDriver.InfName = "C:\Drivers\HP\LaserJet 1320n
\hpc1320c.inf"
uResult = oDriver.AddPrinterDriver(oDriver)

end if

The WmiConnect work fine because remote install of TcpPort work fine
with then same syntax.
All locations (c:\Drivers\HP....) are on the remote server.
I have try to declare paths also like that:

oDriver.FilePath = "C:\\Drivers\\HP\\LaserJet
1320n"
oDriver.InfName = "C:\\Drivers\\HP\\LaserJet
1320n\\hpc1320c.inf"


This code fail. What's wrong?

Thank you very much for your help.

Best regards

Jo

8 réponses

Avatar
Corey Thomas - MCSE/MCSA/MCDBA
What error is returned and what code is saying failed?


-Corey

"Jo" wrote:

Hello,

I try to install remotely a printer driver on a Server2003.

My code is:

if WmiConnect(strServer, kNameSpace, strUser, strPassword,
oService) then
set oDriver = oService.Get("Win32_PrinterDriver")
oDriver.Name = "hp LaserJet 1320 PCL 6"
oDriver.SupportedPlatform = "Windows NT x86"
oDriver.Version = "3"
oDriver.FilePath = "C:DriversHPLaserJet
1320n"
oDriver.InfName = "C:DriversHPLaserJet 1320n
hpc1320c.inf"
uResult = oDriver.AddPrinterDriver(oDriver)

end if

The WmiConnect work fine because remote install of TcpPort work fine
with then same syntax.
All locations (c:DriversHP....) are on the remote server.
I have try to declare paths also like that:

oDriver.FilePath = "C:DriversHPLaserJet
1320n"
oDriver.InfName = "C:DriversHPLaserJet
1320nhpc1320c.inf"


This code fail. What's wrong?

Thank you very much for your help.

Best regards

Jo



Avatar
Jo
Hi,

I'm not at wok at this time.
If I remember correctly, AddPrinterDriver return -2147467259
"unspecified automation error"

Tomorrow morning I would give the exact error code.

Jo

On 11 mar, 21:01, Corey Thomas - MCSE/MCSA/MCDBA
wrote:
What error is returned and what code is saying failed?

-Corey



"Jo" wrote:
Hello,

I try to install remotely a printer driver on a Server2003.

My code is:

   if WmiConnect(strServer, kNameSpace, strUser, strPassword,
oService) then
       set oDriver = oService.Get("Win32_PrinterDriver")
       oDriver.Name                   = "hp LaserJet 1320 PCL 6"
       oDriver.SupportedPlatform = "Windows NT x86"
       oDriver.Version                 = "3"
       oDriver.FilePath                = "C:D riversHPLaserJet
1320n"
       oDriver.InfName                = "C:Dr iversHPLaserJet 1320n
hpc1320c.inf"
       uResult = oDriver.AddPrinterDriver(oDriver)

   end if

The WmiConnect work fine because remote install of TcpPort work fine
with then same syntax.
All locations (c:DriversHP....) are on the remote server.
I have try to declare paths also like that:

       oDriver.FilePath                = "C: DriversHPLaserJet
1320n"
       oDriver.InfName                = "C:D riversHPLaserJet
1320nhpc1320c.inf"

This code fail. What's wrong?

Thank you very much for your help.

Best regards

Jo- Masquer le texte des messages précédents -


- Afficher le texte des messages précédents -



Avatar
urkec
"Jo" wrote:

Hello,

I try to install remotely a printer driver on a Server2003.

My code is:

if WmiConnect(strServer, kNameSpace, strUser, strPassword,
oService) then
set oDriver = oService.Get("Win32_PrinterDriver")
oDriver.Name = "hp LaserJet 1320 PCL 6"
oDriver.SupportedPlatform = "Windows NT x86"
oDriver.Version = "3"
oDriver.FilePath = "C:DriversHPLaserJet
1320n"
oDriver.InfName = "C:DriversHPLaserJet 1320n
hpc1320c.inf"
uResult = oDriver.AddPrinterDriver(oDriver)

end if

The WmiConnect work fine because remote install of TcpPort work fine
with then same syntax.
All locations (c:DriversHP....) are on the remote server.
I have try to declare paths also like that:

oDriver.FilePath = "C:DriversHPLaserJet
1320n"
oDriver.InfName = "C:DriversHPLaserJet
1320nhpc1320c.inf"


This code fail. What's wrong?

Thank you very much for your help.

Best regards

Jo



It looks like you need a privilege like this to install printer drivers:

objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True


--
urkec

Avatar
Jo
My WmiConnect function set this privilege.

Thank's for your answer.
Jo

It looks like you need a privilege like this to install printer drivers:

objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", Tr ue

--
urkec- Masquer le texte des messages précédents -

- Afficher le texte des messages précédents -


Avatar
Jo
The exact error code is: -2147217406, Err.Description return "Not
Found"

Of course, driver files are presents on the server in the spécified
location.

Any idea?

Thank's in advance
Jo



If I remember correctly, AddPrinterDriver return -2147467259
"unspecified automation error"

Tomorrow morning I would give the exact error code.

Jo

On 11 mar, 21:01, Corey Thomas - MCSE/MCSA/MCDBA



wrote:
What error is returned and what code is saying failed?

-Corey

"Jo" wrote:
Hello,

I try to install remotely a printer driver on a Server2003.

My code is:

   if WmiConnect(strServer, kNameSpace, strUser, strPassword,
oService) then
       set oDriver = oService.Get("Win32_PrinterDriver")
       oDriver.Name                   = "h p LaserJet 1320 PCL 6"
       oDriver.SupportedPlatform = "Windows NT x86"
       oDriver.Version                 = "3"
       oDriver.FilePath                = "C: DriversHPLaserJet
1320n"
       oDriver.InfName                = "C: DriversHPLaserJet 1320n
hpc1320c.inf"
       uResult = oDriver.AddPrinterDriver(oDriver)

   end if

The WmiConnect work fine because remote install of TcpPort work fine
with then same syntax.
All locations (c:DriversHP....) are on the remote server.
I have try to declare paths also like that:

       oDriver.FilePath                = "C: DriversHPLaserJet
1320n"
       oDriver.InfName                = "C: DriversHPLaserJet
1320nhpc1320c.inf"

This code fail. What's wrong?

Thank you very much for your help.

Best regards

Jo- Masquer le texte des messages précédents -


- Afficher le texte des messages précédents -- Masquer le texte des messages précédents -


- Afficher le texte des messages précédents -




Avatar
Méta-MCI \(MVP\)
Iiii !

Aïe laïke véri meutch if tzeu maissages are inne frintche.
Cinq iou.

Michel Claveau
Avatar
Gilles LAURENT [MVP]
"Jo" a écrit dans le message de
news:
| Hello,

Bonjour,

| I try to install remotely a printer driver on a Server2003.

1- Aborescence du serveur Windows 2003 R2 Fr

C:DriversHPLaserJet 1320n
hpc1320c.cab (à décompresser)
hpc1320c.cat
hpc1320c.inf
p6i2frww.cab (à décompresser) <- French

2- Script d'installation à distance du driver hp :

--- Coupez ici : InstallDriver.vbs ---
Set oWmi=GetObject("winmgmts:srv2003rootcimv2")
Set oDrv=oWmi.Get("Win32_PrinterDriver")
oDrv.Name="hp LaserJet 1320 PCL 6"
oDrv.SupportedPlatform="Windows NT x86"
oDrv.Version="3"
oDrv.InfName="C:DriversHPLaserJet 1320nhpc1320c.inf"
nRc=oDrv.AddPrinterDriver(oDrv)
WScript.Echo nRc
--- Coupez ici : InstallDriver.vbs ---

3- Sur un poste client XP SP2 Fr

Avec un compte administrateur du serveur Windows 2003 :

> cscript //nologo InstallDriver.vbs
0

--
Gilles LAURENT
MVP Windows Server - Admin Frameworks
http://glsft.free.fr
Avatar
Chris Baker
Hi Jo,

I have just run into a similar issue but was getting a return code of 2 from
the addprinterdriver method. I have now resolved this as it was only
effecting newer HP printer drivers. The reason for this is that the
installation files are contained inside cab files. For some reason this
method differs from the code in the GUI and cannot extract them.

To resolve the issue just extract the cab file with the same name as the INF
file and also the *enww.cab file. This should then resolve the issue, if it
is the same problem.

Regards
Chris

"Jo" wrote:

Hello,

I try to install remotely a printer driver on a Server2003.

My code is:

if WmiConnect(strServer, kNameSpace, strUser, strPassword,
oService) then
set oDriver = oService.Get("Win32_PrinterDriver")
oDriver.Name = "hp LaserJet 1320 PCL 6"
oDriver.SupportedPlatform = "Windows NT x86"
oDriver.Version = "3"
oDriver.FilePath = "C:DriversHPLaserJet
1320n"
oDriver.InfName = "C:DriversHPLaserJet 1320n
hpc1320c.inf"
uResult = oDriver.AddPrinterDriver(oDriver)

end if

The WmiConnect work fine because remote install of TcpPort work fine
with then same syntax.
All locations (c:DriversHP....) are on the remote server.
I have try to declare paths also like that:

oDriver.FilePath = "C:DriversHPLaserJet
1320n"
oDriver.InfName = "C:DriversHPLaserJet
1320nhpc1320c.inf"


This code fail. What's wrong?

Thank you very much for your help.

Best regards

Jo