Cpo Design

Executing PowerShell from c# example

Pavel Svarc Wednesday, January 17, 2018 1:40 PM

Outline of the scenario

I want to execute PowerShell commands from my .NET application.

In order to do that I have create a simple example. Obviously this is based on my research and it is NOT production ready code in any way. Therefore it needs to be modified if you want to use it in production.

 

This is only working proof of concept.

Dependencies:

In order to make this run I need to install the following nuget package:

<package id="System.Management.Automation" version="6.1.7601.17515" targetFramework="net47" />

I have included the sample in gists below. I hope it helps.

Related posts

Currenlty there are no related articles.