473,544 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AddPrinterDrive r WMI

I am trying to write c# code to automatically install Printer Drivers from
our network.

I have the program working with one exception. It will only install
Digitally Signed Drivers and the problem is we have some printers that don't
have Signed Drivers.

Does anyone know a work around to allow Unsigned Drivers to install.

I have included a snipit of code that MgmtClassGen.ex e in ..\SDK\v1.1
generated.

public static System.UInt32 AddPrinterDrive r
(System.Managem ent.ManagementB aseObject DriverInfo)
{
bool IsMethodStatic = true;
if ((IsMethodStati c == true)) {
System.Manageme nt.ManagementBa seObject inParams = null;
System.Manageme nt.ManagementPa th mgmtPath = new
System.Manageme nt.ManagementPa th(CreatedClass Name);
System.Manageme nt.ManagementCl ass classObj = new
System.Manageme nt.ManagementCl ass(statMgmtSco pe, mgmtPath, null);
inParams = classObj.GetMet hodParameters(" AddPrinterDrive r");
inParams["DriverInfo "] = DriverInfo;
System.Manageme nt.ManagementBa seObject outParams =
classObj.Invoke Method("AddPrin terDriver", inParams, null);
return
System.Convert. ToUInt32(outPar ams.Properties["ReturnValu e"].Value);
}
else {
return System.Convert. ToUInt32(0);
}
}

--
Dave S
Visual Studio .NET 2003

Nov 17 '05 #1
0 2596

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4269
by: future_retro | last post by:
Hi, I'm trying to use the AddPrinterDriver method of Win32_PrinterDriver to create a new..... print driver. I can't get my head round how I need to do this. So far I have import win32com.client WBEM = win32com.client.GetObject(r"winmgmts:{impersonationLevel=impersonate}!\\" + "." + r"\root\cimv2")...
0
1335
by: Brett Mostert | last post by:
Hi, I need to be able to Enumerate through Printer Drivers, ports, printers and so fourth. And even add printers, ports, and drivers and setup printers. Sofar i can do all of the following except anything to do with drivers. I have added a reference to the PRNADMIN.DLL from MS Windows 2003 Tool Kit into my project to do all of the...
1
2029
by: future_retro | last post by:
Hi all, cannot work this one out at all... import win32com.client WBEM = win32com.client.GetObject(r"winmgmts:{impersonationLevel=impersonate}!\\" + servername + r"\root\cimv2") WBEM.Security_.Privileges.AddAsString("SeLoadDriverPrivilege") drv = WBEM.Get("Win32_PrinterDriver") drv.Properties_('Name').Value = "HP Color LaserJet 8550 PCL...
4
6989
by: Brett Mostert | last post by:
Hi, I need to be able to Enumerate through Printer Drivers, ports, printers and so fourth. And even add printers, ports, and drivers and setup printers. Sofar i can do all of the following except anything to do with drivers. I have added a reference to the PRNADMIN.DLL from MS Windows 2003 Tool Kit into my project to do all of the...
0
7449
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7385
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7642
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7405
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5950
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5316
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4938
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3432
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.