WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WMI
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

FileSizeEX returns 0 for the Pagefile.sys File

Keywords:    fileSizeEX returns 0 for the Pagefile.sys file 

Question:

I am trying to pull the PageFile.Sys size from a list of computers. When I use "size = FileSizeEX(file)" the response is 0. I receive the same response when using the FileSize command.

Is there a reason why the command isn't returning the size of the file? Is there a better command to run to find out the setting for the pagefile?

Answer:

The pagefile is a problem. Some obscure security issue. However if you have 2002E here is some code that works...
;--------------------------------------------------------------------------------
;The 2002E+ versions of Winbatch have a few new functions for enumerating OLE 
;collections. This includes access to all the WMI information on the computer.
;WMI stands for 'Windows Management Instrumentation'. 
;Here's the reference from Microsoft: 
;
;   msdn.microsoft.com/library/en-us/wmisdk/wmi/wmi_start_page.asp?frame=true
;   msdn.microsoft.com/library/en-us/wmisdk/wmi/wmi_reference.asp?frame=true
;
; And here are some Winbatch examples: 
;
;techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/WMI+!WMI~Reference!.txt
;For details on the Win32_Bios WMI Class, see: 
;
;   msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_bios.asp?frame=true
;
;
;--------------------------------------------------------------------------------
;
Locator = ObjectOpen("WbemScripting.SWbemLocator")
Service = Locator.ConnectServer()
Security = Service.Security_
Security.ImpersonationLevel = 3
 
MemSet = Service.InstancesOf("Win32_LogicalMemoryConfiguration")

hEnum = ObjectCollectionOpen(MemSet)

While 1
  Mem = ObjectCollectionNext(hEnum)
  If Mem == 0 Then Break
    TotalPhysicalMemory = Mem.TotalPhysicalMemory
    TotalVirtualMemory =  Mem.TotalVirtualMemory
    TotalPageFileSpace =  Mem.TotalPageFileSpace
  ObjectClose(Mem)
EndWhile

ObjectCollectionClose(hEnum)

ObjectClose(MemSet)

ObjectClose(Security)
ObjectClose(Service)
ObjectClose(Locator)

  Message("TotalPhysicalMemory",TotalPhysicalMemory)
  Message("TotalVirtualMemory", TotalVirtualMemory)
  Message("TotalPageFileSpace", TotalPageFileSpace)



Exit

Article ID:   W15358
File Created: 2014:07:18:09:12:00
Last Updated: 2014:07:18:09:12:00