# 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 (opens new window)

# Remarks

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

System.Management.Automation (opens new window) 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 (opens new window)

PM> Install-Package System.Management.Automation