Extract info about Total Physical Memory WITHOUT WMI???? 
Author Message
 Extract info about Total Physical Memory WITHOUT WMI????

I would like to enumerate all of our domain workstations for their
total physical memory.

Wherever I look, I see suggestions based on WMI. This is not an option
at this time.

Workstations are all running Windows NT 4.0 sp6a.

adThanksvance

Verne



Sat, 23 Oct 2004 00:15:11 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????
You really spiked our guns on this one...:)

The problem is that as you probably know, WMI is a virtual necessity for
information-gathering; other solutions have to be hacked out piecemeal
typically.

In your particular situation, it makes sense to try something else; installing
WMI just to read the amount of available memory is definitely overkill,
especially if you are trying to identify RAM-starved systems.

One thing you might try is the WshMemory.DLL from Clarence Washington's site;
you can find it on the page

http://cwashington.netreach.net/main/tools/default.asp?topic=n-z

It still needs to be copied locally and installed on each system, but you can do
that from within the same the script that checks for memory.


Quote:
> I would like to enumerate all of our domain workstations for their
> total physical memory.

> Wherever I look, I see suggestions based on WMI. This is not an option
> at this time.

> Workstations are all running Windows NT 4.0 sp6a.

> adThanksvance

> Verne



Sat, 23 Oct 2004 04:19:20 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????
I do not think there are anything available except WMI.
Not even sure if you can "API" to the remote hosts for the memory.
Well...  here is a dirty way of doing things.
You will need to have regdmp.exe from reskit.
Script can be converted to run recursively for the list of machines.


If {%1}=={} goto :Syntax
Set rKey="HKEY_LOCAL_MACHINE\HARDWARE\RESOURCEMAP\System Resources\Physical
Memory"
For /f "skip=2 delims=;" %%I in ('regdmp -m \\%1 %rKey%') do For /f
"tokens=4" %%J in ("%%I") do set t=%%J
set /a b1=%t:~0,4%*16777216
set /a b2=0x%t:~4,2%*65536
set /a b3=0x%t:~6,2%*256
set /a b4=0x%t:~8,2%
set /a X=%b1%+%b2%+%b3%+%b4%+16371712
set /a rMem=%X%/1048576
Echo Memory = ~%rMem% Mb
goto :EOF
:Syntax
Echo. Syntax: rmem.cmd [Host_Name]
=======================================

Regards,
--
Gurgen Alaverdian
http://www.gurgensvbstuff.com

Quote:
> I would like to enumerate all of our domain workstations for their
> total physical memory.

> Wherever I look, I see suggestions based on WMI. This is not an option
> at this time.

> Workstations are all running Windows NT 4.0 sp6a.

> adThanksvance

> Verne



Sat, 23 Oct 2004 13:18:31 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????
Gurgen, it would be really easy to dump the registry entries with WMI - erk!


Quote:
> I do not think there are anything available except WMI.
> Not even sure if you can "API" to the remote hosts for the memory.
> Well...  here is a dirty way of doing things.
> You will need to have regdmp.exe from reskit.
> Script can be converted to run recursively for the list of machines.

> ======================================

> If {%1}=={} goto :Syntax
> Set rKey="HKEY_LOCAL_MACHINE\HARDWARE\RESOURCEMAP\System Resources\Physical
> Memory"
> For /f "skip=2 delims=;" %%I in ('regdmp -m \\%1 %rKey%') do For /f
> "tokens=4" %%J in ("%%I") do set t=%%J
> set /a b1=%t:~0,4%*16777216
> set /a b2=0x%t:~4,2%*65536
> set /a b3=0x%t:~6,2%*256
> set /a b4=0x%t:~8,2%
> set /a X=%b1%+%b2%+%b3%+%b4%+16371712
> set /a rMem=%X%/1048576
> Echo Memory = ~%rMem% Mb
> goto :EOF
> :Syntax
> Echo. Syntax: rmem.cmd [Host_Name]
> =======================================

> Regards,
> --
> Gurgen Alaverdian
> http://www.gurgensvbstuff.com


> > I would like to enumerate all of our domain workstations for their
> > total physical memory.

> > Wherever I look, I see suggestions based on WMI. This is not an option
> > at this time.

> > Workstations are all running Windows NT 4.0 sp6a.

> > adThanksvance

> > Verne



Sat, 23 Oct 2004 13:27:18 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????

Quote:

> I would like to enumerate all of our domain workstations for their
> total physical memory.

> Wherever I look, I see suggestions based on WMI. This is not an option
> at this time.

> Workstations are all running Windows NT 4.0 sp6a.

Easy. Use Psinfo.exe (part of the PsTools suite, free) from www.sysinternals.com

--
torgeir



Sat, 23 Oct 2004 15:03:22 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????
Sure it would... If you have it installed though...(-:

--
Gurgen Alaverdian
http://www.gurgensvbstuff.com


Quote:
> Gurgen, it would be really easy to dump the registry entries with WMI -
erk!



> > I do not think there are anything available except WMI.
> > Not even sure if you can "API" to the remote hosts for the memory.
> > Well...  here is a dirty way of doing things.
> > You will need to have regdmp.exe from reskit.
> > Script can be converted to run recursively for the list of machines.

> > ======================================

> > If {%1}=={} goto :Syntax
> > Set rKey="HKEY_LOCAL_MACHINE\HARDWARE\RESOURCEMAP\System
Resources\Physical
> > Memory"
> > For /f "skip=2 delims=;" %%I in ('regdmp -m \\%1 %rKey%') do For /f
> > "tokens=4" %%J in ("%%I") do set t=%%J
> > set /a b1=%t:~0,4%*16777216
> > set /a b2=0x%t:~4,2%*65536
> > set /a b3=0x%t:~6,2%*256
> > set /a b4=0x%t:~8,2%
> > set /a X=%b1%+%b2%+%b3%+%b4%+16371712
> > set /a rMem=%X%/1048576
> > Echo Memory = ~%rMem% Mb
> > goto :EOF
> > :Syntax
> > Echo. Syntax: rmem.cmd [Host_Name]
> > =======================================

> > Regards,
> > --
> > Gurgen Alaverdian
> > http://www.gurgensvbstuff.com


> > > I would like to enumerate all of our domain workstations for their
> > > total physical memory.

> > > Wherever I look, I see suggestions based on WMI. This is not an option
> > > at this time.

> > > Workstations are all running Windows NT 4.0 sp6a.

> > > adThanksvance

> > > Verne



Sun, 24 Oct 2004 00:28:50 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????

Quote:


> > > I do not think there are anything available except WMI.
> > > Not even sure if you can "API" to the remote hosts for the memory.
> > > Well...  here is a dirty way of doing things.
> > > You will need to have regdmp.exe from reskit.
> > > Script can be converted to run recursively for the list of machines.

> > > ======================================

> > > If {%1}=={} goto :Syntax
> > > Set rKey="HKEY_LOCAL_MACHINE\HARDWARE\RESOURCEMAP\System
>  Resources\Physical
> > > Memory"
> > > For /f "skip=2 delims=;" %%I in ('regdmp -m \\%1 %rKey%') do For /f
> > > "tokens=4" %%J in ("%%I") do set t=%%J
> > > set /a b1=%t:~0,4%*16777216
> > > set /a b2=0x%t:~4,2%*65536
> > > set /a b3=0x%t:~6,2%*256
> > > set /a b4=0x%t:~8,2%
> > > set /a X=%b1%+%b2%+%b3%+%b4%+16371712
> > > set /a rMem=%X%/1048576
> > > Echo Memory = ~%rMem% Mb
> > > goto :EOF
> > > :Syntax
> > > Echo. Syntax: rmem.cmd [Host_Name]
> > > =======================================

> > > Regards,
> > > --
> > > Gurgen Alaverdian
> > > http://www.gurgensvbstuff.com

Thanks Gurgen

Can I ask you to explain the math? Is it possible to do the same thing
in VBScript (I'm not asking for you to do it, only to give me an idea
if it worth my time).

Where did you get the numbers, by the way?

Verne



Mon, 25 Oct 2004 04:40:43 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????

Quote:
> You really spiked our guns on this one...:)

> The problem is that as you probably know, WMI is a virtual necessity for
> information-gathering; other solutions have to be hacked out piecemeal
> typically.

Don't I know it!!

Quote:
> One thing you might try is the WshMemory.DLL from Clarence Washington's site;
> you can find it on the page

> http://cwashington.netreach.net/main/tools/default.asp?topic=n-z

> It still needs to be copied locally and installed on each system, but you can do
> that from within the same the script that checks for memory.

I think I will try to go with Gurgen's batch file. I have already
confirmed Torgeir's proposal, though it is somewhat inflexible. I will
have to script something to parse the output into some sort of report.


Mon, 25 Oct 2004 04:44:18 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????

Quote:


> > I would like to enumerate all of our domain workstations for their
> > total physical memory.

> > Wherever I look, I see suggestions based on WMI. This is not an option
> > at this time.

> > Workstations are all running Windows NT 4.0 sp6a.

> Easy. Use Psinfo.exe (part of the PsTools suite, free) from www.sysinternals.com

Thanks Torgeir

It did work, though the report is overly detailed for my requirements.
I will have to extract the relevant data and create my own report.
Probably use vbscript.



Mon, 25 Oct 2004 04:45:37 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????
Verne,

I would probably wrote this in vb script except the fact that the value of
this key is impossible to get via VBscript (not counting WMI).
The regobj.dll, I use to get the remote values, fails to retrieve this value
although it had no problem retrieving the other binary values from
"Hardware" tree.
The information about physical memory above 16 mb is stored in the last 4
bytes of the ".Translated" value in "HKLM\HARDWARE\RESOURCEMAP\System
Resources\Physical Memory".

Should I able to get it in VB script, the value would be assigned to the
array and I would use "UBound - 4 to Ubound" loop to get those values.
The math is as follows:
Say the last 4 bytes are:  00 00 00 1f
b1 = CDbl("&H" & "1e") * 16777216  '(256^3)
b2 = CDbl("&H" & "00") * 65536  '(256^1)
b3 = CDbl("&H" & "00") * 256  '(256^1)
b4 = CDbl("&H" & "00") * 1  '(256^0)
16371712 is a 16 Mb
mem = (b1 + b2 + b3 + b4 +  16371712) / 1024*1024
mem = 511.61328125 mb

Filter from Regdmp represents that number as hex i.e. 0x1f000000. Same
routine here only backward.

I suppose it's easier to filter memory info. from "psinfo" output as Torgeir
suggested.

Regards,

--
Gurgen Alaverdian
http://www.gurgensvbstuff.com

Quote:


> > > > I do not think there are anything available except WMI.
> > > > Not even sure if you can "API" to the remote hosts for the memory.
> > > > Well...  here is a dirty way of doing things.
> > > > You will need to have regdmp.exe from reskit.
> > > > Script can be converted to run recursively for the list of machines.

> > > > ======================================

> > > > If {%1}=={} goto :Syntax
> > > > Set rKey="HKEY_LOCAL_MACHINE\HARDWARE\RESOURCEMAP\System
> >  Resources\Physical
> > > > Memory"
> > > > For /f "skip=2 delims=;" %%I in ('regdmp -m \\%1 %rKey%') do For /f
> > > > "tokens=4" %%J in ("%%I") do set t=%%J
> > > > set /a b1=%t:~0,4%*16777216
> > > > set /a b2=0x%t:~4,2%*65536
> > > > set /a b3=0x%t:~6,2%*256
> > > > set /a b4=0x%t:~8,2%
> > > > set /a X=%b1%+%b2%+%b3%+%b4%+16371712
> > > > set /a rMem=%X%/1048576
> > > > Echo Memory = ~%rMem% Mb
> > > > goto :EOF
> > > > :Syntax
> > > > Echo. Syntax: rmem.cmd [Host_Name]
> > > > =======================================

> > > > Regards,
> > > > --
> > > > Gurgen Alaverdian
> > > > http://www.gurgensvbstuff.com

> Thanks Gurgen

> Can I ask you to explain the math? Is it possible to do the same thing
> in VBScript (I'm not asking for you to do it, only to give me an idea
> if it worth my time).

> Where did you get the numbers, by the way?

> Verne



Mon, 25 Oct 2004 06:32:37 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????
Here's a routine:

'Extract the line with the memory data
sData = FirstMatch("Physical memory:[ A-Z0-9]*", sData)
wscript.echo sData

Function CmdOut(cmdexec)
 dim oX, oSh
 set oSh = CreateObject("WScript.Shell")
 set oX = oSh.Exec("%COMSPEC% /C " & cmdexec)
 Do While oX.Status = 0:WScript.Sleep 10:Loop
 CmdOut = oX.StdOut.Readall
End Function

Function FirstMatch(patrn, strng)
   Dim rx, Match, Matches   ' Create variable.
   Set rx = New RegExp   ' Create a regular expression.
   rx.Pattern = patrn : rx.IgnoreCase = True : rx.Global = True
   Set Matches = rx.Execute(strng)   ' Execute search.
   For Each Match in Matches   ' Iterate Matches collection.
      FirstMatch = Match.Value
      Exit Function
   Next
End Function



Quote:

> > > I would like to enumerate all of our domain workstations for their
> > > total physical memory.

> > > Wherever I look, I see suggestions based on WMI. This is not an option
> > > at this time.

> > > Workstations are all running Windows NT 4.0 sp6a.

> > Easy. Use Psinfo.exe (part of the PsTools suite, free) from

www.sysinternals.com
Quote:

> Thanks Torgeir

> It did work, though the report is overly detailed for my requirements.
> I will have to extract the relevant data and create my own report.
> Probably use vbscript.



Mon, 25 Oct 2004 10:52:14 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????

Quote:

> Verne,

> I would probably wrote this in vb script except the fact that the value of
> this key is impossible to get via VBscript (not counting WMI).
> The regobj.dll, I use to get the remote values, fails to retrieve this value
> although it had no problem retrieving the other binary values from
> "Hardware" tree.
> The information about physical memory above 16 mb is stored in the last 4
> bytes of the ".Translated" value in "HKLM\HARDWARE\RESOURCEMAP\System
> Resources\Physical Memory".

> Should I able to get it in VB script, the value would be assigned to the
> array and I would use "UBound - 4 to Ubound" loop to get those values.
> The math is as follows:
> Say the last 4 bytes are:  00 00 00 1f
> b1 = CDbl("&H" & "1e") * 16777216  '(256^3)
> b2 = CDbl("&H" & "00") * 65536  '(256^1)
> b3 = CDbl("&H" & "00") * 256  '(256^1)
> b4 = CDbl("&H" & "00") * 1  '(256^0)
> 16371712 is a 16 Mb
> mem = (b1 + b2 + b3 + b4 +  16371712) / 1024*1024
> mem = 511.61328125 mb

> Filter from Regdmp represents that number as hex i.e. 0x1f000000. Same
> routine here only backward.

> I suppose it's easier to filter memory info. from "psinfo" output as Torgeir
> suggested.

> Regards,

> --
> Gurgen Alaverdian
> http://www.gurgensvbstuff.com

Gurgen

I wouldn't say Torgeir's suggestion is easier. Your suggestion was the
most direct and just as easy to execute. With his, I have to cull the
information, or which there is more. With your suggestion, I thought I
could get a bit more. As I was going to script the other key queries,
I thought I might attempt to script them all.

What I may end up doing is 'shelling' to the command prompt to execute
your Batch file, then pull the info back from a temp file. Then I can
add the CPU speed, type, and some internal keys.

Thanks again.

PS I did like your suggestion very much. I would guess that I would
have a difficult time rounding the results to equal the DIMM totals
i.e. 128 instead of 126 or 127 in the same batch file.



Mon, 25 Oct 2004 14:11:29 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????
I didn't post the most important piece of text in my post below - what that
routine does.  If you look at what I put up, it extracts the RAM data for you.
You can also run the exact same routine again and extract the CPU info as
well...



Quote:
> > Verne,

> > I would probably wrote this in vb script except the fact that the value of
> > this key is impossible to get via VBscript (not counting WMI).
> > The regobj.dll, I use to get the remote values, fails to retrieve this value
> > although it had no problem retrieving the other binary values from
> > "Hardware" tree.
> > The information about physical memory above 16 mb is stored in the last 4
> > bytes of the ".Translated" value in "HKLM\HARDWARE\RESOURCEMAP\System
> > Resources\Physical Memory".

> > Should I able to get it in VB script, the value would be assigned to the
> > array and I would use "UBound - 4 to Ubound" loop to get those values.
> > The math is as follows:
> > Say the last 4 bytes are:  00 00 00 1f
> > b1 = CDbl("&H" & "1e") * 16777216  '(256^3)
> > b2 = CDbl("&H" & "00") * 65536  '(256^1)
> > b3 = CDbl("&H" & "00") * 256  '(256^1)
> > b4 = CDbl("&H" & "00") * 1  '(256^0)
> > 16371712 is a 16 Mb
> > mem = (b1 + b2 + b3 + b4 +  16371712) / 1024*1024
> > mem = 511.61328125 mb

> > Filter from Regdmp represents that number as hex i.e. 0x1f000000. Same
> > routine here only backward.

> > I suppose it's easier to filter memory info. from "psinfo" output as Torgeir
> > suggested.

> > Regards,

> > --
> > Gurgen Alaverdian
> > http://www.gurgensvbstuff.com

> Gurgen

> I wouldn't say Torgeir's suggestion is easier. Your suggestion was the
> most direct and just as easy to execute. With his, I have to cull the
> information, or which there is more. With your suggestion, I thought I
> could get a bit more. As I was going to script the other key queries,
> I thought I might attempt to script them all.

> What I may end up doing is 'shelling' to the command prompt to execute
> your Batch file, then pull the info back from a temp file. Then I can
> add the CPU speed, type, and some internal keys.

> Thanks again.

> PS I did like your suggestion very much. I would guess that I would
> have a difficult time rounding the results to equal the DIMM totals
> i.e. 128 instead of 126 or 127 in the same batch file.



Mon, 25 Oct 2004 14:34:46 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????

Very nice :)

--
torgeir


Quote:
> Here's a routine:

> 'Extract the line with the memory data
> sData = FirstMatch("Physical memory:[ A-Z0-9]*", sData)
> wscript.echo sData

> Function CmdOut(cmdexec)
>  dim oX, oSh
>  set oSh = CreateObject("WScript.Shell")
>  set oX = oSh.Exec("%COMSPEC% /C " & cmdexec)
>  Do While oX.Status = 0:WScript.Sleep 10:Loop
>  CmdOut = oX.StdOut.Readall
> End Function

> Function FirstMatch(patrn, strng)
>    Dim rx, Match, Matches   ' Create variable.
>    Set rx = New RegExp   ' Create a regular expression.
>    rx.Pattern = patrn : rx.IgnoreCase = True : rx.Global = True
>    Set Matches = rx.Execute(strng)   ' Execute search.
>    For Each Match in Matches   ' Iterate Matches collection.
>       FirstMatch = Match.Value
>       Exit Function
>    Next
> End Function



Mon, 25 Oct 2004 18:32:06 GMT  
 Extract info about Total Physical Memory WITHOUT WMI????
Except I couldn't kill the blipping text from the line....


Quote:

> Very nice :)

> --
> torgeir


> > Here's a routine:

> > 'Extract the line with the memory data
> > sData = FirstMatch("Physical memory:[ A-Z0-9]*", sData)
> > wscript.echo sData

> > Function CmdOut(cmdexec)
> >  dim oX, oSh
> >  set oSh = CreateObject("WScript.Shell")
> >  set oX = oSh.Exec("%COMSPEC% /C " & cmdexec)
> >  Do While oX.Status = 0:WScript.Sleep 10:Loop
> >  CmdOut = oX.StdOut.Readall
> > End Function

> > Function FirstMatch(patrn, strng)
> >    Dim rx, Match, Matches   ' Create variable.
> >    Set rx = New RegExp   ' Create a regular expression.
> >    rx.Pattern = patrn : rx.IgnoreCase = True : rx.Global = True
> >    Set Matches = rx.Execute(strng)   ' Execute search.
> >    For Each Match in Matches   ' Iterate Matches collection.
> >       FirstMatch = Match.Value
> >       Exit Function
> >    Next
> > End Function



Mon, 25 Oct 2004 19:50:27 GMT  
 
 [ 18 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Total physical memory

2. Need to Determine the Total Physical Memory of a Remote Computer

3. WMI Available Physical Memory

4. WMI Physical Memory Available

5. How to check remote physical memory without a remote client

6. extracting info without opening file

7. Drive size and Total memory

8. Help - Determine Physical Memory in System?

9. Physical Memory ?

10. available physical memory

11. Physical Memory

12. Display Physical Memory of Remote Machine

 

 
Powered by phpBB® Forum Software