G
Guest
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.exe in ..\SDK\v1.1
generated.
public static System.UInt32 AddPrinterDriver
(System.Management.ManagementBaseObject DriverInfo)
{
bool IsMethodStatic = true;
if ((IsMethodStatic == true)) {
System.Management.ManagementBaseObject inParams = null;
System.Management.ManagementPath mgmtPath = new
System.Management.ManagementPath(CreatedClassName);
System.Management.ManagementClass classObj = new
System.Management.ManagementClass(statMgmtScope, mgmtPath, null);
inParams = classObj.GetMethodParameters("AddPrinterDriver");
inParams["DriverInfo"] = DriverInfo;
System.Management.ManagementBaseObject outParams =
classObj.InvokeMethod("AddPrinterDriver", inParams, null);
return
System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
return System.Convert.ToUInt32(0);
}
}
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.exe in ..\SDK\v1.1
generated.
public static System.UInt32 AddPrinterDriver
(System.Management.ManagementBaseObject DriverInfo)
{
bool IsMethodStatic = true;
if ((IsMethodStatic == true)) {
System.Management.ManagementBaseObject inParams = null;
System.Management.ManagementPath mgmtPath = new
System.Management.ManagementPath(CreatedClassName);
System.Management.ManagementClass classObj = new
System.Management.ManagementClass(statMgmtScope, mgmtPath, null);
inParams = classObj.GetMethodParameters("AddPrinterDriver");
inParams["DriverInfo"] = DriverInfo;
System.Management.ManagementBaseObject outParams =
classObj.InvokeMethod("AddPrinterDriver", inParams, null);
return
System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
return System.Convert.ToUInt32(0);
}
}