Im trying to convert the following function to vb.net. This was origionally in a wsh script and was working fine. The problem mainly is that .NET no longer supports the Eval method. To describe the function a little: When called it is passed a wmi class name to check ie "Win32_System" and a property ie "Computername" it then executes a wmi query on the machine to get the information. And returns it in a comma seperated string. The purpose of the Eval statement is to allow the property to be specified dynamically. Any ideas on what I could use to replace that Eval statement?
VB.NET:
Private Function GetSystemInfo(strWMIClass,strProperty)
counter = 0
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & SystemPath & "\root\cimv2")
Set colProc = objWMIService.ExecQuery ("Select * from " & strWMIClass)
For each prop in colProc
HardwareValue = HardwareValue & Eval("prop." & strProperty ) & ","
Next
If HardwareValue <> "" Then
GetSystemInfo = Mid(HardwareValue,1,Len(HArdwareValue)-1) 'Trim off trailing comma
Else
GetSystemInfo = 0
End If
End Function