Notifications
Clear all
[Closed] detecting hardware
Aug 04, 2014 7:56 pm
Is there any way to detect what kind of hardware is installed on given computer by maxscript e.g motherboard model, network card model etc ?
3 Replies
1 Reply
I not know is this posible by using mxs but with C# (ManagementObjectSearcher) is posible for sure. See this link.
Aug 04, 2014 7:56 pm
yup
http://forums.autodesk.com/t5/Programming/DotNet-Get-Hardware-Information/td-p/4128896
http://forums.cgsociety.org/showthread.php?t=826813
you can search for DotNetObject “System.Management.ManagementClass” and find more details…
Fn GetHardwareProp HwClass HwProp = (
local HwInfo,HwInfoEnumerator,OutArray
OutArray = #()
try ( HwInfo = (DotNetObject "System.Management.ManagementClass" HwClass).GetInstances() ) Catch (
DotNet.LoadAssembly "System.Management.dll"
HwInfo = (DotNetObject "System.Management.ManagementClass" HwClass).GetInstances()
)
HwInfoEnumerator = HwInfo.GetEnumerator()
while (HwInfoEnumerator.MoveNext()) do (
for prop in HwProp do (
local TempString = try( HwInfoEnumerator.Current.Item[prop] as string ) catch()
if TempString != "" do (
append OutArray prop
append OutArray TempString
)
)
)
OutArray
)
cpuInfo = GetHardwareProp "Win32_Processor" #("ProcessorID", "Name", "Revision", "SystemName")
gpuInfo = GetHardwareProp "Win32_VideoController" #("AdapterRAM", "PNPDeviceID", "Name")
mbInfo = GetHardwareProp "Win32_BaseBoard" #("Manufacturer", "Product")
procID = cpuInfo[(findItem cpuInfo "ProcessorID")+1] ; procName = cpuInfo[(findItem cpuInfo "Name")+1]
procRevision = cpuInfo[(findItem cpuInfo "Revision")+1] ; sysName = cpuInfo[(findItem cpuInfo "SystemName")+1]
gpuRAM = gpuInfo[(findItem gpuInfo "AdapterRAM")+1] ; gpuID = gpuInfo[(findItem gpuInfo "PNPDeviceID")+1]
gpuName = gpuInfo[(findItem gpuInfo "Name")+1] ; mbManu = mbInfo[(findItem mbInfo "Manufacturer")+1]
mbName = mbInfo[(findItem mbInfo "Product")+1]