0
Я удаленного подключения к консоли PowerShell с помощью C#:Cast в C# объекта с помощью удаленного PowerShell
using (Runspace remoteRunspace = RunspaceFactory.CreateRunspace(setUpConnection()))
{
remoteRunspace.Open();
using (PowerShell powershell = PowerShell.Create())
{
powershell.Runspace = remoteRunspace;
DateTime dateTime = GetTime(powershell); // <------ How to implement?
}
remoteRunspace.Close();
}
Я хочу, чтобы вызвать команду Get-Date PowerShell и как-то отбрасывать PSObject
к DateTime
. Что такое «обычный» способ решить эту проблему?
http://msdn.microsoft.com/en-us/library/system.management.automation.powershell%28v=vs.85%29.aspx – Saren