3 WMI/CIM questions 
Author Message
 3 WMI/CIM questions

Hi

I'm just learning about VBScript, WSH and WMI.
There are 3 questions that I haven't been able to find the
answer to yet (I need some code examples in order to learn
from it):

1. I wan't to find out the memory configuration on my
computer. For instance if I have 2 x 64 MB RAM or 1 x 128
+ 1 x 64.
What would be the best way of doing that?

2. In relation to the first question, how can I round off
the amount of RAM? If I for instance take the whole value
of Physical memory through WMI I get a value of 200851456.
I would much rather prefer it presenting the value of 192
MB RAM (1 x 128 + 1 x 64).
Any ideas?

3. As I'm reading about WMI and all the
information/functionality it can provide me with, it
raises the question of how I can extract information
about/from other network devices such as printservers,
switches, routers etc.
The book I'm reading only covers WMI. I guess I need a
different moniker string... or...?

Thanks for your help.

Best regards
Wayne{*filter*}



Sat, 18 Dec 2004 05:02:18 GMT  
 3 WMI/CIM questions


Quote:
> Hi

> I'm just learning about VBScript, WSH and WMI.
> There are 3 questions that I haven't been able to find the
> answer to yet (I need some code examples in order to learn
> from it):

> 1. I wan't to find out the memory configuration on my
> computer. For instance if I have 2 x 64 MB RAM or 1 x 128
> + 1 x 64.
> What would be the best way of doing that?

Here's a sample script snippet.

Set oWMI = GetObject("winmgmts://./root/cimv2")

sData =  "[Physical Memory]" & vbCrLf
sData =  sData &  "Bank Label, Capacity, Description," _
 & "DeviceLocator, DataWidth, FormFactor" & vbCrLf

for each memory in oWMI.InstancesOf("Win32_PhysicalMemory")
 counter  = counter + 1
 sData = sData & memory.BankLabel & "," &  CStr(memory.capacity) _
 & "," &  memory.Description & "," &  memory.DeviceLocator _
 & "," &  memory.DataWidth  & "," &  memory.FormFactor & vbCrLf
next
wscript.echo counter
wscript.echo sData

Quote:
> 2. In relation to the first question, how can I round off
> the amount of RAM? If I for instance take the whole value
> of Physical memory through WMI I get a value of 200851456.
> I would much rather prefer it presenting the value of 192
> MB RAM (1 x 128 + 1 x 64).
> Any ideas?

The value is in bytes.  There are 1024 bytes in a binary kilobyte (KiB),
and 1024 KiB in a binary megabyte (MiB).

Quote:
> 3. As I'm reading about WMI and all the
> information/functionality it can provide me with, it
> raises the question of how I can extract information
> about/from other network devices such as printservers,
> switches, routers etc.
> The book I'm reading only covers WMI. I guess I need a
> different moniker string... or...?

You would need to have a mechanism for connecting to the remote device
and getting data from it; it won't be as easy as using WMI,
unfortunately, and will depend on what the device OEM did to make it
manageable.
Quote:
> Thanks for your help.

> Best regards
> Wayne{*filter*}



Sat, 18 Dec 2004 06:06:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Adding Win32_PerfFormattedData to CIM/V2

2. Anybody doing work win MS WMI & CIM?

3. Scripting-Newbie question - WMI

4. Scripting newbie question on WMI

5. WMI impersonation question

6. Novice Question: Using VBScript + WMI within ASP

7. VBS/WMI remote connection question

8. WMI Question

9. WMI Question

10. WMI Question

11. WMI Win32_ComputerSystem/Win32_Process Question (Again)

12. WMI Win32_ComputerSystem/Win32_Process Question

 

 
Powered by phpBB® Forum Software