public class MyInfo
{
public string Status { get; set; }
public string Class { get; set; }
public string FriendlyName { get; set; }
public string InstanceId { get; set; }
}
string strScript = "Get-PnpDevice";
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript(strScript);
pipeline.Commands.Add("Out-String");
Collection<PSObject> results = pipeline.Invoke();
runspace.Close();
foreach (PSObject pSObject in results)
{
}
After JsonConvert.SerializeObject(pSObject);
{"CliXml":"<Objs Version=\"1.1.0.1\" xmlns=\"http://schemas.microsoft.com/powershell/2004/04\">\r\n <S>_x000D__x000A_Status Class FriendlyName InstanceId _x000D__x000A_------ ----- ------------ ---------- _x000D__x000A_Unknown HIDClass HID-compliant consumer control device HID\\VID_0..._x000D__x000A_OK System System board ACPI\\PNP0..._x000D__x000A_OK System Motherboard resources ACPI\\PNP0..._x000D__x000A_OK System Motherboard resources SWD\\MSRRA..._x000D__x000A_Unknown HIDClass HID-compliant vendor-defined device HID\\VID_0..._x000D__x000A__x000D__x000A__x000D__x000A_</S>\r\n</Objs>"}
But I need is MyClasss.Class so i can diferentiate or make some condition on it .