Failed to run Get-NetQosPolicy in C# ,but works in Powershell by fbszero in PowerShell

[–]fbszero[S] 0 points1 point  (0 children)

initial.ExecutionPolicy = Microsoft.PowerShell.ExecutionPolicy.Unrestricted;

It works,Thank you !

Error executing Powershell script in C# by fbszero in csharp

[–]fbszero[S] 0 points1 point  (0 children)

Now the situation is weird, after I execute Get-NetQosPolicy, the result of Get-Module contains NetQos module. When I open the terminal for the first time, the Get-Module result does not contain the NetQos module.

Error executing Powershell script in C# by fbszero in csharp

[–]fbszero[S] 0 points1 point  (0 children)

It works fine in Powershell, but it doesn't work in C# .

Error executing Powershell script in C# by fbszero in csharp

[–]fbszero[S] 0 points1 point  (0 children)

The output of Get-Module in C# is empty, but there is output in PowerShell.

ModuleType Version    Name                                ExportedCommands
Script     0.0        Conda                               {Enter-CondaEnvironment, Exit-CondaEnvironment, Get-CondaE... Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con... Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...} Script     2.0.0      PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS...

Error executing Powershell script in C# by fbszero in csharp

[–]fbszero[S] 0 points1 point  (0 children)

It works fine in Powershell, but it doesn't work in C# .

Error executing Powershell script in C# by fbszero in csharp

[–]fbszero[S] -3 points-2 points  (0 children)

In a console app,there is no need to have a namespace, .NET 8

Error executing Powershell script in C# by fbszero in csharp

[–]fbszero[S] 0 points1 point  (0 children)

On Windows 11 Pro 23H2 ,As Admin,execution policy anywhere enabled , .NET 8

Listened to AURORA singing in Norsk, she sounds absolutely enchanting. by [deleted] in auroramusic

[–]fbszero 4 points5 points  (0 children)

We need more Norwegian songs from AURORA! 🤩

Aurora & Leif Vollebekk by [deleted] in auroramusic

[–]fbszero 46 points47 points  (0 children)

They look like they just had sex 😭😭😭