# System.Management.Automation

# Invoke simple synchronous pipeline

Get the current date and time.

public class Program
{
    static void Main()
    {
        // create empty pipeline
        PowerShell ps = PowerShell.Create();

        // add command
        ps.AddCommand("Get-Date");

        // run command(s)
        Console.WriteLine("Date: {0}", ps.Invoke().First());

        Console.ReadLine();
    }
}

enter image description here

# Remarks

The **System.Management.Automation** namespace is the root namespace for Windows PowerShell.

System.Management.Automation is an extension library from Microsoft and it can be added to Visual Studio projects via NuGet package manager or package manager console.

nuget-ui

PM> Install-Package System.Management.Automation