Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 591643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:39:21+00:00 2026-05-13T15:39:21+00:00

I’ve written a little VBScript program to query the page file usage under Windows

  • 0

I’ve written a little VBScript program to query the page file usage under Windows XP (eventually 2003/2008 Server as well) but the figures I seem to be getting are bizarre.

This is the program:

Set wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
for i = 1 to 10
    Set qry1 = wmi.ExecQuery ("Select * from Win32_PageFileSetting")
    Set qry2 = wmi.ExecQuery ("Select * from Win32_PerfRawData_PerfOS_PagingFile")
    initial = 0
    maximum = 0
    For Each obj in qry1
        initial = initial + obj.InitialSize
        maximum = maximum + obj.MaximumSize
    Next
    For Each obj in qry2
        if obj.Name = "_Total" then
            Wscript.Echo _
                " Initial size: " & initial & _
                " Maximum size: " & maximum & _
                " Percent used: " & obj.PercentUsage & _
                ""
        end if
    Next
    qry1 = none
    qry2 = none
    WScript.sleep (1000)
Next

which outputs:

Initial size: 1512 Maximum size: 3024 Percent used: 21354
Initial size: 1512 Maximum size: 3024 Percent used: 21354
Initial size: 1512 Maximum size: 3024 Percent used: 21354
Initial size: 1512 Maximum size: 3024 Percent used: 21354
Initial size: 1512 Maximum size: 3024 Percent used: 21354
Initial size: 1512 Maximum size: 3024 Percent used: 21354
Initial size: 1512 Maximum size: 3024 Percent used: 21354
Initial size: 1512 Maximum size: 3024 Percent used: 21354
Initial size: 1512 Maximum size: 3024 Percent used: 21354
Initial size: 1512 Maximum size: 3024 Percent used: 21354

The doco on MSDN states:

PercentUsage
    Data type: uint32
    Access type: Read-only
    Qualifiers:
        DisplayName ("% Usage")
        CounterType (537003008)
        DefaultScale (0)
        PerfDetail (200)
    Percentage of the page file instance in use. For more information,
    see the PageFileBytes property in Win32_PerfRawData_PerfProc_Process.

Now that seems pretty straight-forward. Why is my 3G page file using 21000% of it’s allocated space? That would be about 630G but pagefile.sys is only about 1.5G (and my entire hard disk is only 186G).


Update:

When I get the same field from Win32_PerfFormattedData_PerfOS_PagingFile, I get a more reasonable value of 5 but that still doesn’t seem to coincide with Task Manager, which shows 1.06G usage out of the 3G maximum.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:39:21+00:00Added an answer on May 13, 2026 at 3:39 pm

    You can’t operate with the value directly like that.

    The CounterType of the ProcessUsage property is 537003008, which according to this table corresponds to the PERF_RAW_FRACTION counter. Given the formula from the second link, we end up with something like this:

    " Percent used: " & ((obj.PercentUsage * 100) / obj.PercentUsage_Base) & _
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 378k
  • Answers 378k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The PRF used in TLSv1 and all earlier SSL versions… May 14, 2026 at 9:17 pm
  • Editorial Team
    Editorial Team added an answer SELECT proposal_book, COUNT(*) AS cnt FROM proposals WHERE proposal_date >=… May 14, 2026 at 9:17 pm
  • Editorial Team
    Editorial Team added an answer Security-wise what you've done is sufficient. But there is more… May 14, 2026 at 9:17 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.