How To Use PowerShell in C#

  Рет қаралды 25,546

Blue Hippo

Blue Hippo

Күн бұрын

Пікірлер: 23
@the_crazyguy
@the_crazyguy 2 жыл бұрын
Great vid! Short and sweet, and to the point. Thanks a lot!
@barnes0924
@barnes0924 8 ай бұрын
Thanks so much for the tutorial! I was stuck for a while with no output on the console, but after looking at your code I realized I forgot the "!" in the last if statement which caused my console to output nothing.
@stevea1708
@stevea1708 11 ай бұрын
Nice short and sweet. Can this easily be converted to work in a winform?
@bluehippotech
@bluehippotech 11 ай бұрын
Absolutely it can
@MrSurfsAlot
@MrSurfsAlot 2 жыл бұрын
this is very useful thank you very much
@spiffylich3349
@spiffylich3349 2 жыл бұрын
doesnt seem to work. always get: "system management automation namespace not found"
@bluehippotech
@bluehippotech 2 жыл бұрын
You need to install the package from nuget :D
@jlumley
@jlumley 2 жыл бұрын
@@bluehippotech only System.Management.Instrumentation is appearing
@jlumley
@jlumley 2 жыл бұрын
@@bluehippotech Microsoft.PowerShell.5.1.ReferenceAssemblies is the one
@bluehippotech
@bluehippotech 2 жыл бұрын
Where?
@gallacticvr4157
@gallacticvr4157 2 жыл бұрын
@@jlumley Sick Lad
@Saberune1
@Saberune1 Жыл бұрын
Hey man. This works great :) However, I was wondering if you know how I can have it display the full errors (or where to check them). I'm getting "An error has occured which PowerShell cannot handle..." for one of my scripts that I'm running from my app but I am having a hard time troubleshooting it with the generic error. Any help would be much appreciated thank you!
@bluehippotech
@bluehippotech Жыл бұрын
Instead of subscribing to the output stream you can subscribe to the error stream :D
@Saberune1
@Saberune1 Жыл бұрын
Thank you so much for the quick reply! I don’t quite understand what you mean by subscribing to the error stream instead of the output stream. I thought the ps.Streams.Error.DataAdded line was already subscribing to the error stream. Sorry for the trouble and thank you again for the help!
@bluehippotech
@bluehippotech Жыл бұрын
Oh yeah you're absolutely right. Have you tried running the powershell script with powershell 7 to see if you get a proper error there? I've had issues a few times because of powershell 7, but it might just be that your script is made for powershell 5?
@nyshone
@nyshone 2 жыл бұрын
In case I want to use my program on another computer, does it need to have powershell 7 installed for it to work? Does it need the DLL files to be present in a new environment, or can it be standalone? Thank you for the answer in advance.
@nifex123
@nifex123 5 ай бұрын
Thank you sir
@bluehippotech
@bluehippotech 5 ай бұрын
Thanks for watching!
@jamesmartin-kk6uk
@jamesmartin-kk6uk 2 жыл бұрын
Hey mate! Great video! not sure if you're still looking at this! I was wondering if you knew how to set the execution policy for the powershell instance? I tried: _ps.AddCommand("Set-ExecutionPolicy").AddParameter("ExecutionPolicy", "Unrestricted").AddParameter("scope","LocalMachine").Invoke(); But am receiving "AuthorizationManager check failed." as an error still :( I'm also running the C# program as an Administrator @Blue Hippo
@minimalstory
@minimalstory 2 жыл бұрын
thanks for help)
@on4ayl
@on4ayl 2 жыл бұрын
Would have been a great video if not for tiny illegible text.
@bluehippotech
@bluehippotech 2 жыл бұрын
Just watched it on my phone, you're right, it's way too small if you're not on a PC. My bad :/ Thanks for the feedback, it helps me get better!
PowerShell - Observing Inline C# Compilation with Add-Type
16:44
John Hammond
Рет қаралды 25 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 14 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 147 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 52 МЛН
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 14 МЛН
Http Get And Post In C#
19:37
Nick Proud
Рет қаралды 99 М.
Building Binary PowerShell Cmdlets
19:48
Adam Driscoll
Рет қаралды 3 М.
Writing C# in VS Code Is Finally Awesome!
7:48
Nick Chapsas
Рет қаралды 179 М.
C# Tutorial - Run PowerShell Command from C# Winform App
6:32
Pretty Powershell
13:13
Chris Titus Tech
Рет қаралды 133 М.
PowerShell Functions
36:06
TechThoughts
Рет қаралды 44 М.
How To Create Custom PowerShell Cmdlets (Tutorial)
13:03
ITPro Today
Рет қаралды 3,4 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 14 МЛН