[THIN] Re: OT: WMI - Installed Memory vs Available Memory

  • From: nuvolari@xxxxxxx
  • To: thin@xxxxxxxxxxxxx
  • Date: Mon, 13 Feb 2012 20:07:59 +0100 (CET)

Hi Steve,

Here's my script that reads the SN of a HP TC and rename the computer name 
using the asset tag. I tested it on my Dell laptop and it correctly displays 
the asste tag as well.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery _
    ("Select * from Win32_BIOS")
For each objBIOS in colBIOS
    Name = objBIOS.SerialNumber
    Set objWMIService = GetObject("Winmgmts:root\cimv2")

    For Each objComputer in _
            objWMIService.InstancesOf("Win32_ComputerSystem")

        Return = objComputer.rename(Name)
        If Return <> 0 Then
           WScript.Echo "Rename failed. Error = " & Err.Number
        Else
           WScript.Echo "Rename succeeded." & _
               " Reboot for new name to go into effect"
        End If
    Next
Next

Cheers,
Safdar.


----- Original Message -----
From: "Jeremy Saunders" <jeremy@xxxxxxxxxxxxxxxxxxxx>
To: thin@xxxxxxxxxxxxx
Sent: Friday, February 10, 2012 2:30:29 PM
Subject: [THIN] Re: OT: WMI - Installed Memory vs Available Memory




I don’t have a Dell to test it on, but you get it from Win32_BIOS or 
Win32_BaseBoard 

  

From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf Of 
Steve Snyder 
Sent: Friday, 10 February 2012 5:48 PM 
To: thin@xxxxxxxxxxxxx 
Subject: [THIN] Re: OT: WMI - Installed Memory vs Available Memory 

  

you wouldn't happen to know if there's a way to set/read the asset tag field in 
a DELL BIOS would you? ;) 


On Fri, Feb 10, 2012 at 8:52 AM, Jeremy Saunders < jeremy@xxxxxxxxxxxxxxxxxxxx 
> wrote: 



No probs. Also add the following two lines to the top of that code. 

  

Const wbemFlagReturnImmediately = &h10 

Const wbemFlagForwardOnly = &h20 

  

  

From: thin-bounce@xxxxxxxxxxxxx [mailto: thin-bounce@xxxxxxxxxxxxx ] On Behalf 
Of Steve Snyder 
Sent: Friday, 10 February 2012 3:39 PM 
To: thin@xxxxxxxxxxxxx 
Subject: [THIN] Re: OT: WMI - Installed Memory vs Available Memory 



  

Sweet! 

I saw the physicalMemory/Capacity but only got 2GB out of it so I assumed it 
was just the max size DIMM the system was capable of as my script editor just 
tells me "The total capacity of this physical memory, in bytes." Didn't realize 
it was per installed DIMM. 

Thanks! 


On Fri, Feb 10, 2012 at 8:29 AM, Jeremy Saunders < jeremy@xxxxxxxxxxxxxxxxxxxx 
> wrote: 



Yep, that’s happened to me before, so I use Win32_PhysicalMemory to get the 
real number. 

  

strComputer = "." 

Set objWMIService = GetObject("winmgmts:" & 
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory", 
"WQL", _ 

  wbemFlagReturnImmediately + wbemFlagForwardOnly) 

intTotalPhysicalMemory = 0 

For Each objItem In colItems 

  intMemory = ((objItem.capacity) / 1024) / 1024 

  intTotalPhysicalMemory = intTotalPhysicalMemory + intMemory 

Next 

wscript.echo "Total Physical Memory Installed : " & intTotalPhysicalMemory & " 
Mb" 

  

Cheers, 

Jeremy. 

  

From: thin-bounce@xxxxxxxxxxxxx [mailto: thin-bounce@xxxxxxxxxxxxx ] On Behalf 
Of Steve Snyder 
Sent: Friday, 10 February 2012 3:05 PM 
To: thin@xxxxxxxxxxxxx 
Subject: [THIN] OT: WMI - Installed Memory vs Available Memory 


  

Ok, 

Right-click on My Computer, select properties and look at the memory listed, 
probably something like 4.00GB. Now bring up taskman and on the Performance tab 
look at Physical Memory: Total. mine is 3324MB. 

What WMI string do I use to see the installed memory as listed on the system 
properties? Win32_ComputerSystem/TotalPhysicalMemory gives me the available 
physical memory as reported in taskman. 

  

 
************************************************
For Archives, RSS, to Unsubscribe, Subscribe or
set Digest or Vacation mode use the below link:
//www.freelists.org/list/thin
************************************************

Other related posts: