Win32_PhysicalMedia Problem
-
Hi all, I am trying to execute this line of code but it not providing me the values
ManagementObjectSearcher pd = new ManagementObjectSearcher("SELECT Name, MediaType, MediaDescription from Win32_PhysicalMedia");
foreach (ManagementObject mp in pd.Get())
richTextBox3.Text += mp["Name"] + " " + mp["MediaType"] + " " + mp["MediaDescription"];Can anybody please tell me what i am doing wrong or if i need to include something in this... mainly i want to find media type... Thanks in advance
-
Hi all, I am trying to execute this line of code but it not providing me the values
ManagementObjectSearcher pd = new ManagementObjectSearcher("SELECT Name, MediaType, MediaDescription from Win32_PhysicalMedia");
foreach (ManagementObject mp in pd.Get())
richTextBox3.Text += mp["Name"] + " " + mp["MediaType"] + " " + mp["MediaDescription"];Can anybody please tell me what i am doing wrong or if i need to include something in this... mainly i want to find media type... Thanks in advance
Try "select * from Win32_PhysicalMedia" and see if that returns values. I'm surprised the code even compiles because mp["Name"] will return an object. Try. mp["Name"].ToString(), mp["MediaType"].ToString()... Also don't forget to dispose of the ManagementObjectSearcher pd.
"You get that on the big jobs."