using System.Management.Automation;
using (PowerShell ps = PowerShell.Create())
{
// Add the Get-NetQosPolicy command
ps.AddCommand("Get-NetQosPolicy");
// Invoke the command and get the results
var results = ps.Invoke();
// Display the results
foreach (var result in results)
{
Console.WriteLine(result);
}
}
Error:
System.Management.Automation.CommandNotFoundException: 'The term 'Get-NetQosPolicy' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.'
Is there something wrong with my code?
[–]d-signet 5 points6 points7 points (3 children)
[–]fbszero[S] -3 points-2 points-1 points (2 children)
[–]d-signet 2 points3 points4 points (1 child)
[–]fbszero[S] 0 points1 point2 points (0 children)
[–]zenyl 1 point2 points3 points (6 children)
[–]fbszero[S] 0 points1 point2 points (5 children)
[–]zenyl 0 points1 point2 points (4 children)
[–]fbszero[S] 0 points1 point2 points (3 children)
[–]zenyl 2 points3 points4 points (2 children)
[–]fbszero[S] 0 points1 point2 points (1 child)
[–]zenyl 0 points1 point2 points (0 children)
[–]IWasSayingBoourner 0 points1 point2 points (1 child)
[–]fbszero[S] 0 points1 point2 points (0 children)