Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5 KiB

  1. '
  2. ' Usage: pagefile <newInitialSize> <newMaximumSize>
  3. '
  4. on error resume next
  5. ' NB - change the name of the pagefile as appropriate, or enter it as commandline arg
  6. Set pagefile = GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_PageFile=""C:\\Pagefile.sys""")
  7. if err = 0 then
  8. WScript.Echo "Current Pagefile Characteristics"
  9. WScript.Echo "================================"
  10. WScript.Echo
  11. WScript.Echo "Initial Size = " & pagefile.InitialSize
  12. WScript.Echo "Maximum Size = " & pagefile.MaximumSize
  13. ' Set the new values from the arguments
  14. pagefile.InitialSize = WScript.Arguments (0)
  15. pagefile.MaximumSize = WScript.Arguments (1)
  16. WScript.Echo
  17. WScript.Echo "New Pagefile Characteristics"
  18. WScript.Echo "================================"
  19. WScript.Echo
  20. WScript.Echo "Initial Size = " & pagefile.InitialSize
  21. WScript.Echo "Maximum Size = " & pagefile.MaximumSize
  22. set shell = CreateObject ("WScript.Shell")
  23. i = shell.Popup ("Do you want to commit these settings?", , "Pagefile Sample", 1)
  24. WScript.Echo ""
  25. if i = 1 then
  26. ' Commit the changes - will take effect on next reboot
  27. pagefile.Put_
  28. if err = 0 then
  29. 'Changes made
  30. WScript.Echo "You will need to restart your system for these changes to take effect"
  31. else
  32. WScript.Echo "Error saving changes: " & Err.Description & " [0x" & Hex(Err.number) & "]"
  33. end if
  34. else
  35. end if
  36. else
  37. WScript.Echo "Error - could not access pagefile [0x" & Hex(Err.Number) & "]"
  38. end if