コード例 #1
0
 public string Get()
 {
     try
     {
         var(_, info) = PowerShellVersionTableScenario.OutputVersionTable();
         return(info);
     }
     catch (Exception e)
     {
         return(e.ToString());
     }
 }
コード例 #2
0
        // https://www.nuget.org/packages/Microsoft.PowerShell.SDK/
        //
        // Official documentation https://github.com/PowerShell/PowerShell/tree/master/docs/host-powershell
        // SO https://stackoverflow.com/questions/39141914/running-powershell-from-net-core
        //
        static void Main(string[] args)
        {
            var(errVT, resultVT) = PowerShellVersionTableScenario.OutputVersionTable();
            Console.WriteLine($"Version table, Errors: {errVT}{Environment.NewLine}{resultVT}");

            Console.WriteLine("Exchange scenarios, please provide an admin user account");
            Console.Write("Admin user: "******"Password: "******"Call#1, Errors: {errS1}, Result: {resultS1}");

            var(errS2, resultS2) = RemoteExchangePowerShellScenarios.WSManConnectToExO(admin, pass);
            Console.WriteLine($"Call#1, Errors: {errS2}, Result: {resultS2}");

            Console.Read();
        }