Page 1 of 1 1
Topic Options
#197494 - 2010-01-21 11:53 PM page file info
Hari_Kata Offline
Fresh Scripter

Registered: 2008-01-20
Posts: 5
Loc: KL
following code is giving some wrong output.

$_colItems = $_objWMIService.ExecQuery("Select * from CIM_OperatingSystem",,48)
If @ERROR $_colItems = 0 Exit Val('&' + Right(DecToHex(@ERROR), 4)) EndIf
For Each $_objItem In $_colItems

$_ = CINT((CDBL($_objItem.FreeSpaceInPagingFiles)) / 1024) ; Page file currently unused and available
$_SI[13] = '' + $_ + $_SI[13]

Next
$_colItems = 0

My system total page file size is 3046MB. By above code, free page file size is showing as 3497MB.

this is the code for total page file.

$_colItems = $_objWMIService.ExecQuery("Select * from Win32_PageFile",,48)
If @ERROR $_colItems = 0 Exit Val('&' + Right(DecToHex(@ERROR), 4)) EndIf
$_B = 0
For Each $_objItem In $_colItems

$_ = CINT((CDBL($_objItem.MaximumSize))) ; Total Page File
$_B = $_B + $_

Next
$_SI[12] = $_B
$_colItems = 0

Can any one inform me what property i need to use so that i can get the exact free page file size.

Top
#197495 - 2010-01-22 09:06 AM Re: page file info [Re: Hari_Kata]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Is your paging file fixed to an exact size, are your letting "windows manage" your paging space or do you have a high/low range specified?

If either of the last two then my guess would be that the free spacefigure might include unallocated free space that Windows could grow the paging file(s) into if it needed.

Found this (old from 2005) comment from an MS community support post:
 Quote:
I am afraid the documentation is not accurate here, in your scenario, the value in SizeStoredInPagingFiles would match the Commit Charge Limit which just as the same as the value shown by Task Manager. And the value of the FreeSpaceInPagingFiles would be calculated by subtracting the Commit Charge Total value from SizeStoredInPagingFiles


This might have changed with subsequent updates, see MS KB article: http://support.microsoft.com/kb/885827

I tried on my machine with the script below:
 Code:
For Each $objOS in GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")

	         "Name                     = "+$objOS.Caption+@CRLF
		+"  Version                = "+$objOS.Version+@CRLF
		+"  Free paging space      = "+CInt(CDbl($objOS.FreeSpaceInPagingFiles)/1024)+" MB"+@CRLF
		+"  Stored in paging space = "+CInt(CDbl($objOS.SizeStoredInPagingFiles)/1024)+" MB"+@CRLF
		+"  Total swap space       = "+CInt(CDbl($objOS.TotalSwapSpaceSize)/1024)+" MB"+@CRLF
		+"  Free physical memory   = "+CInt(CDbl($objOS.FreePhysicalMemory)/1024)+" MB"+@CRLF
		+"  Total virtual memory   = "+CInt(CDbl($objOS.TotalVirtualMemorySize)/1024)+" MB"+@CRLF
		+"  Free virtual memory    = "+CInt(CDbl($objOS.FreeVirtualMemory)/1024)+" MB"+@CRLF
		+"  Total visible memory   = "+CInt(CDbl($objOS.TotalVisibleMemorySize)/1024)+" MB"+@CRLF
Next


Sample output:
 Code:
Name                     = Microsoft Windows XP Professional
  Version                = 5.1.2600
  Free paging space      = 4070 MB
  Stored in paging space = 4955 MB
  Total swap space       = 0 MB
  Free physical memory   = 2123 MB
  Total virtual memory   = 2048 MB
  Free virtual memory    = 2004 MB
  Total visible memory   = 3070 MB


My systems' physical RAM is 3GB, paging space is set to range 2046 - 4092, so the "total visible memory" is pretty close ro the physical, and the "total virtual memory" is pretty close to the real size of the paging file which was reported as 2046 at the time of execution.


Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 837 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.054 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org