© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
18 replies
The Guy

C# pnputil not recognized

public void InstallPrinter(PrinterInfo printer)
{
string script = $@"script to install printer. install driver using pnputil."
using (PowerShell ps = PowerShell.Create())
{
ps.AddScript(script);

try
{
var results = ps.Invoke();

if (ps.HadErrors)
{
foreach (var error in ps.Streams.Error)
{
Console.WriteLine($"Error: {error}");
}
}
else
{
foreach (var result in results)
{
Console.WriteLine(result.ToString());
}
}
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
I checked the log and the error occur during the driver installation and it's because it doesn't recognize pnputil. No problem running in powershell console.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Reference not recognized
C#CC# / help
3y ago
❔ csc command not recognized?
C#CC# / help
3y ago
❔ empty string not being recognized
C#CC# / help
4y ago
Workload ID maui is not recognized.
C#CC# / help
11mo ago