WMI pagefile check on remote PC fails where local PC works
WMI pagefile check on remote PC fails where local PC works
(OP)
Hi all - I've got a script that returns various PC details but for some reason the pagefile info isn't retrieved from remote PCs (shows as blank) but is retrieved fine if I enter my own PC as the target. Sometimes remote DNS/IP info is missing aswell but I'm not too worried about those oddities. Eg script below the PC info shows when remote PC is a target but pagefile doesn't - eg ideas?
CODE --> vbscript
On Error Resume Next Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20 Dim OutputTxt ' Here we initialize the variables for user interaction Title = "Computer Name" Message = "Enter Computer name" ' Ask for Computer name strComputer = Trim(InputBox(Message,Title,"",5000,5000)) Set objshell = CreateObject("Wscript.shell") Set fso = CreateObject("Scripting.FileSystemObject") Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") ' PC Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem In colItems pcmake = objItem.Manufacturer pcmodel = objItem.Model pcname = objItem.Name pctype = objItem.SystemType pcmemory = objItem.TotalPhysicalMemory pcusername = objItem.UserName Next ' Pagefile 'set pcpagefile = wmic pagefileset GET maximumsize /value 'pcpagefile = Replace(objitem.MaximumSize,"MaximumSize=","") set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PageFile", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem In colItems pagefilename = objitem.Name pagefilesize1 = objitem.InitialSize pagefilesize2 = objitem.MaximumSize Next
_________________________________
Leozack
CODE
MakeUniverse($infinity,1,42);
RE: WMI pagefile check on remote PC fails where local PC works
RE: WMI pagefile check on remote PC fails where local PC works
f1.Writeline("Pagefile: Name: " & pagefilename)
f1.Writeline(" Initial Size: " & FormatNumber(pagefilesize1,0) & " m")
f1.Writeline(" Max Size: " & FormatNumber(pagefilesize2,0) & " m")
But if using a remote PC they will just be blank besides the m's on the end - that's without on error resume next
_________________________________
Leozack
CODE
RE: WMI pagefile check on remote PC fails where local PC works
http://www.activexperts.com/admin/scripts/wmi/vbsc...
Not sure if this gives the same information though.
RE: WMI pagefile check on remote PC fails where local PC works
_________________________________
Leozack
CODE
RE: WMI pagefile check on remote PC fails where local PC works
Try changing this:
CODE -->
CODE -->
Note that for this type of query to work, your account needs to have admin rights to the target system.
I hope that helps.
Regards,
Mark
No trees were harmed in posting this message, however a significant number of electrons were terribly inconvenienced.
Check out my scripting solutions at http://www.thespidersparlor.com/vbscript
Work SMARTER not HARDER.
RE: WMI pagefile check on remote PC fails where local PC works
I hope that helps.
Regards,
Mark
No trees were harmed in posting this message, however a significant number of electrons were terribly inconvenienced.
Check out my scripting solutions at http://www.thespidersparlor.com/vbscript
Work SMARTER not HARDER.
RE: WMI pagefile check on remote PC fails where local PC works
_________________________________
Leozack
CODE
RE: WMI pagefile check on remote PC fails where local PC works
CODE
...returns nothing on my Win7 box (64-bit), including when invoking the script from an elevated command prompt. It does work on XP and a 2003 (also 32-bit) server.
RE: WMI pagefile check on remote PC fails where local PC works
I copied your code without modification and ran it on my work PC (Win 7 x64). Here is the response I get back.
Looks to me like that code is fine and you are dealing with a permissions issue.
I hope that helps.
Regards,
Mark
No trees were harmed in posting this message, however a significant number of electrons were terribly inconvenienced.
Check out my scripting solutions at http://www.thespidersparlor.com/vbscript
Work SMARTER not HARDER.
RE: WMI pagefile check on remote PC fails where local PC works
RE: WMI pagefile check on remote PC fails where local PC works
Another way to check is to use WBEMTEST which is the built in WMI tool that has been around but hidden since Windows 95.
Run WBEMTEST from the run command.
Click Connect
Click Connect
Click Enum Instances
Type Win32_Pagefile
Click OK
Double click the text in the box
In the center pane you should now see your instances details. Look for the caption or file size properties to ensure you are connected and have access.
You can follow this article to check the security that is set (written for XP but still applies).
http://support.microsoft.com/kb/295292
I hope that helps.
Regards,
Mark
No trees were harmed in posting this message, however a significant number of electrons were terribly inconvenienced.
Check out my scripting solutions at http://www.thespidersparlor.com/vbscript
Work SMARTER not HARDER.
RE: WMI pagefile check on remote PC fails where local PC works
_________________________________
Leozack
CODE
RE: WMI pagefile check on remote PC fails where local PC works
But I do appreciate you pointing out WBEMTEST.... i have never used that before!
RE: WMI pagefile check on remote PC fails where local PC works
Guitarzan, WBEMTEST was originally designed to be just used by MS support personnel, then the word got out about it. The interface is really clunky because it was not intended for the masses to use, but it can really come in handy when you need to get info about a system.
I hope that helps.
Regards,
Mark
No trees were harmed in posting this message, however a significant number of electrons were terribly inconvenienced.
Check out my scripting solutions at http://www.thespidersparlor.com/vbscript
Work SMARTER not HARDER.
RE: WMI pagefile check on remote PC fails where local PC works
Ok so I've tested more today. It seems with either of these lines
'Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
I get the same results - some remote PCs ARE replying with pagefile info, and others aren't. I have a nasty feeling that the ones that are blank have no pagefile (set to 0 in windows) which is why I wanted to include pagefile info in our remote PC details in the first place. Argh ...
_________________________________
Leozack
CODE
RE: WMI pagefile check on remote PC fails where local PC works
CODE --> vbscript
_________________________________
Leozack
CODE
RE: WMI pagefile check on remote PC fails where local PC works
I hope that helps.
Regards,
Mark
No trees were harmed in posting this message, however a significant number of electrons were terribly inconvenienced.
Check out my scripting solutions at http://www.thespidersparlor.com/vbscript
Work SMARTER not HARDER.