Problem installing network printers using drivers stored on a NAS storage

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal Greetings everybody,<br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal <br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal Im trying to install a network printer using an administrator user but Im getting the error message (Operation couldnt be completed error 0x00000032), when I searched
for this error message I found that it means that the user is not authenticated to install the printer but Im sure the user is admin and the password is correct.<br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal <br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal The scenario is:<br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal 1-Open a network connection to the NAS storage using username & password to be able to read the printers drivers.<br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal 2-Create TCP/IP Port using domain admin user.<br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal 3-Install the printer using domain admin user.<br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal <br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal The Code:
<pre class="prettyprint public Form1()
{

InitializeComponent();

//Open Connection to NAS Storage when form loads >> Step 1
ProcessStartInfo P = new ProcessStartInfo();
P.FileName = "net";
P.Arguments = "use "\\10.11.3.133\CIB Library" /user:username password";
P.CreateNoWindow = true;
P.UseShellExecute = false;
Process.Start(P);

}

private void Test_Click(object sender, EventArgs e)
{

//Using Credentials
SecureString password = new SecureString();
foreach (char c in "xyz") password.AppendChar(c);

//Create Printer TCP/IP port >> Step 2
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = "cscript";
info.Arguments = @"c:WindowsSystem32Printing_Admin_Scriptsen-USprnport.vbs -a -r IP_10.17.10.176 -h 10.17.10.176 -o raw";
info.UserName = "username";
info.Password = password;
info.Domain = "domain";
info.UseShellExecute = false;
info.CreateNoWindow = true;
Process.Start(info);

//Install the printer >> Step 3
string _systemRoot = Environment.GetEnvironmentVariable("SYSTEMROOT");
string _system32 = Environment.GetEnvironmentVariable("SYSTEMROOT") + @"/System32";
info.WorkingDirectory = _system32;
info.FileName = _system32 + @"/RUNDLL32";
info.Arguments = "printui.dll, PrintUIEntry /if /b "HP LaserJet 4250n" /f "\\10.11.3.133\CIB Library\Drivers\Printers XP\HP\HP 4250 CD\Drivers\i386(32 bit - 2000_XP_S2003_Vista)\PS\hpc4x50d.inf" /r "IP_10.17.10.176" /m "HP LaserJet 4250 PS"";
info.UserName = "username";
info.Password = password;
info.Domain = "domain";
info.UseShellExecute = false;
info.CreateNoWindow = true;
Process.Start(info);
}[/code]
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal I think the problem is a conflict between the domain credentials I use in the printer installation part of the code and the credentials used to connect to the NAS storage
where the printer driver locates because I have no problem creating the TCP/IP port or installing printers using local stored drivers.<br/>

<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal <br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal I hope this makes it easier for you to solve my problem<br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal <br style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal
<span style="font-family:Verdana,Arial,sans-serif; font-size:13px; line-height:normal Thanks in advance for your help

<br/>
<br/>


View the full article
 
Back
Top