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 7565159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:04:51+00:00 2026-05-30T14:04:51+00:00

I have the following code where I am trying to gather rich information about

  • 0

I have the following code where I am trying to gather rich information about processes in Windows Server 2003. My problem occurs when I’m trying to pull back the process owner for a process which finishes between the initial WMI query and the call to get the owner. If the process has finished in the mean time then an error is raised and the script stops. I’d rather just check if the process is not available and not output to the console if it isn’t. I’ve looked at the reference and there doesn’t seem to be an appropriate method for this. Any help much appreciated.

The error raised is…

getProcessInfo2.vbs(42, 5) SWbemObjectEx: Not found

strComputer = "." 
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"_
     & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_Process",,48) 

For Each objItem in colItems 

    'Calculated Fields
    sngProcessTime = ( CSng(objItem.KernelModeTime) + CSng(objItem.UserModeTime)) / 10000000


    Wscript.Echo
    Wscript.Echo "ProcessId                  : " & objItem.ProcessId
    Wscript.Echo "CommandLine                : " & objItem.CommandLine
    Wscript.Echo "CreationDate               : " & objItem.CreationDate
    Wscript.Echo "HandleCount                : " & objItem.HandleCount
    Wscript.Echo "Name                       : " & objItem.Name
    Wscript.Echo "PageFaults                 : " & objItem.PageFaults
    Wscript.Echo "PageFileUsage              : " & objItem.PageFileUsage
    Wscript.Echo "ParentProcessId            : " & objItem.ParentProcessId
    Wscript.Echo "PeakPageFileUsage          : " & objItem.PeakPageFileUsage
    Wscript.Echo "PeakVirtualSize            : " & objItem.PeakVirtualSize
    Wscript.Echo "PeakWorkingSetSize         : " & objItem.PeakWorkingSetSize
    Wscript.Echo "Priority                   : " & objItem.Priority
    Wscript.Echo "QuotaNonPagedPoolUsage     : " & objItem.QuotaNonPagedPoolUsage
    Wscript.Echo "QuotaPagedPoolUsage        : " & objItem.QuotaPagedPoolUsage
    Wscript.Echo "QuotaPeakNonPagedPoolUsage : " & objItem.QuotaPeakNonPagedPoolUsage
    Wscript.Echo "QuotaPeakPagedPoolUsage    : " & objItem.QuotaPeakPagedPoolUsage
    Wscript.Echo "ReadOperationCount         : " & objItem.ReadOperationCount
    Wscript.Echo "ReadTransferCount          : " & objItem.ReadTransferCount
    Wscript.Echo "ThreadCount                : " & objItem.ThreadCount
    Wscript.Echo "VirtualSize                : " & objItem.VirtualSize
    Wscript.Echo "WriteOperationCount        : " & objItem.WriteOperationCount
    Wscript.Echo "WriteTransferCount         : " & objItem.WriteTransferCount
    Wscript.Echo "CPUTime                    : " & sngProcessTime

    Dim Return
    Return = objItem.GetOwner(strNameOfUser)
    If Return <> 0 Then strNameOfUser = "unavailable"

    Wscript.Echo "Owner                      : " & strNameOfUser    
Next
  • 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-30T14:04:53+00:00Added an answer on May 30, 2026 at 2:04 pm

    You just need to check whether your collection item still contains a valid WMI object reference. If the WMI object no longer exists, your reference will become null.

    For Each objItem in colItems
        If IsObject(objItem) Then
            ...
        End If
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code, The problem is when I'm trying to assign the
i am trying to set transparency of all windows. I have following code. public
I have the following code that I am trying to extract the systems proxy
I have the following code that i am trying to change from a regular
I have the following code sample that im trying to wrap my head around
I have the following code. I am trying to bind the Command property of
I have the following code for adding to/extracting from Zip. I'm trying to refactor
I have the following code: Tag.find_all_by_company_id(4).each.collect{|tag| tag.name }.join(,) (Essentially I'm trying to build a
I am trying my hands on WPF MVVM. I have written following code in
Im trying to get debugging working without an app.config. I have the following code:

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.