Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Problem using invoke on "Get-PrintConfiguration"

$
0
0

Get-PrintConfiguration works fine in PowerShell command line. But I can't use invoke in C#.

C# code snip:

-------------------------

PowerShell ps = PowerShell.Create();

ps.AddCommand("Get-PrintConfiguration").AddParameter("PrinterName","printer");

foreach (PSObject obj in ps.Invoke())

{

......................

}

-------------------------

Error: "An error occurred while performing the specified operation"

I don't have other problem with using Powershell from C# 

 

Any idea on how to use Get-PrintConfiguration.


Viewing all articles
Browse latest Browse all 6937

Trending Articles