Exchange Management Powershell with .Net Return Code -


How do I get the return code from the following command:

  Runpace configuration rsConfig = Runspaceconfiguration .volution (); PSSnapInException snapInException = null; PSSnapInInfo info = rsConfig.AddPSSnapIn ("Microsoft.Exchange.Management.Power.Shell.Admin", snapinext out); Runpace myRunSpace = Ranspacefactine Creatorpress (rsconfig); MyRunSpace.Open (); // Build pipeline and script script pipeline pipeline = myRunSpace.CreatePipeline (); String strascript = "new-storage group-server kingcong" + "-LogFolderPath c: \\ rsg \\ logs-name retrieval group -systemfolderpath c: \\ rsg \\ data-retrieval"; // Add order pipeline to the collection of pipeline commands. Command. EdScript (Strasput) archive & lt; PSObject & gt; Results = Pipeline. Invoke ();  

You can get the value and ask for the execution status of the last command (boolean) ? Variable examples:.:

  bool succeeded = myRunspace.SessionStateProxy.GetVariable ("?");  

Comments