Results 1 to 36 of 36

Thread: Need Help - running process on remote machine

  1. #1

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Question Need Help - running process on remote machine

    I have a small problem. This is what I'm running:

    VB Code:
    1. Function IsProcessRunning(strServer, strProcess)
    2.     Dim Process, strObject
    3.     IsProcessRunning = False
    4.     strObject = "winmgmts://" & strServer
    5.     For Each Process In GetObject(strObject).InstancesOf("win32_process")
    6.     If UCase(Process.Name) = UCase(strProcess) Then
    7.         IsProcessRunning = True
    8.     Exit Function
    9.     End If
    10.     Next
    11. End Function
    12.  
    13.  
    14. Public Sub CheckRunning()
    15.     On Error GoTo errhand
    16.     Dim strComputer, strProcess
    17.     lstPrograms.Clear
    18.     strComputer = lstComputers.Text
    19.         strProcess = "notepad.exe"
    20.     If (IsProcessRunning(strComputer, strProcess) = True) Then
    21.         lstPrograms.AddItem "Notepad" & " " & "is running"
    22.     Else
    23.         lstPrograms.AddItem "Notepad" & " " & "is Not running"
    24.     End If

    This works almost all the time, but I run into an error occassionally if I don't have rights to view the machine. I am the network admin so I have full rights to the system, but occassionally, the system will be unavailable.

    How can I fix this so that if it can't check the computer, it will stop and let me know?

    I keep getting the box saying "Retry" or "Switch" and locks up...

    Thanks in advance for the help
    Last edited by Capp; Jul 26th, 2005 at 07:14 PM.
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  2. #2

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - Check for running process on remote machine

    *Update*

    The problem I am also having is, the script I run to list all PC's on my network, lists the ones that are powered off as well.

    So when I try to connect using the function above, it crashes.

    I need to know what I need to add so that if it errors, to stop running.

    I tried doing the:

    On Error GoTo Err

    Err:
    Exit function

    But I am not sure where to put that.


    Thanks for the help
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  3. #3

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    *Bump*

    Nobody has any suggesstions ?
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  4. #4
    Fanatic Member
    Join Date
    Jan 2005
    Location
    In front of this pc.
    Posts
    580

    Re: Need Help - running process on remote machine

    Perhaps you could ping the remote pc's prior to making the connection and only connect if the ping is responded to?

  5. #5
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Need Help - running process on remote machine

    VB Code:
    1. Function IsProcessRunning(strServer, strProcess)
    2. On Error Goto Err
    3.     '
    4.     Dim Process, strObject
    5.     IsProcessRunning = False
    6.     strObject = "winmgmts://" & strServer
    7.     '
    8.     For Each Process In GetObject(strObject).InstancesOf("win32_process")
    9.         '
    10.         If UCase(Process.Name) = UCase(strProcess) Then
    11.             IsProcessRunning = True
    12.             Exit Function
    13.         End If
    14.         '
    15.     Next
    16.     '
    17.     Exit Function
    18. Err:
    19.     If Err.Number = 42 Then
    20.         ' Do SOmething Specific
    21.     Else
    22.         Exit Function ' or:
    23.         Resume Next
    24.     End If
    25. End Function
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  6. #6

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Quote Originally Posted by Dave Sell
    VB Code:
    1. Function IsProcessRunning(strServer, strProcess)
    2. On Error Goto Err
    3.     '
    4.     Dim Process, strObject
    5.     IsProcessRunning = False
    6.     strObject = "winmgmts://" & strServer
    7.     '
    8.     For Each Process In GetObject(strObject).InstancesOf("win32_process")
    9.         '
    10.         If UCase(Process.Name) = UCase(strProcess) Then
    11.             IsProcessRunning = True
    12.             Exit Function
    13.         End If
    14.         '
    15.     Next
    16.     '
    17.     Exit Function
    18. Err:
    19.     If Err.Number = 42 Then
    20.         ' Do SOmething Specific
    21.     Else
    22.         Exit Function ' or:
    23.         Resume Next
    24.     End If
    25. End Function
    Thank you very much. I will try this here shortly.

    How did you get the error code 42? I am curious to learn it.
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  7. #7
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Need Help - running process on remote machine

    From the book, "Hitchhiker's Guide to the Galaxy". It was just an example to show you can do things for specific error codes if you want...
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  8. #8
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Need Help - running process on remote machine

    P.S. in 10 million years I will know how that code is generated...
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  9. #9
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,957

    Re: Need Help - running process on remote machine

    Output err.number on a message box or debug.print and then force the error.

  10. #10

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Ahh! I see. Forgot all about that.

    I'll give it a shot and let you know if it worked.


    Thanks again
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  11. #11

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Same Problem

    My program checks for a few different running processes.
    When it gets to the For Each Process loop in the "IsProcessRunning" function, it hangs and gives me the error. After it cycles through the error several dozen times, it gives me err.number 462 - "Computer not available"

    Since I am calling the function from a sub, if the function fails, it continues on within the sub (which calls the function several times)

    I am in dire need of assistance with this.
    This is the error I'm getting while it is cycling through:

    Title -> Component Request Pending
    Text -> This application cannot be completed because the other application
    is busy. Choose 'Switch To' to activate the busy application and correct the
    problem.
    Options -> Switch To, Retry

    But, when it does give me this error, it doesn't go to the Err: like I have it set to, it just keeps popping up this message.

    I tried this with no success:

    VB Code:
    1. Private Sub cmdCheck_Click()
    2.    CheckRunning
    3. End Sub
    4.  
    5.  
    6. Function IsProcessRunning(strServer, strProcess)
    7. On Error GoTo Err
    8.     Dim Process, strObject
    9.     IsProcessRunning = False
    10.     strObject = "winmgmts://" & strServer
    11.     For Each Process In GetObject(strObject).InstancesOf("win32_process") 'this is where it hangs and errors
    12.     If UCase(Process.Name) = UCase(strProcess) Then
    13.         IsProcessRunning = True
    14.     Exit Function
    15.     End If
    16.     Next
    17.     Exit Function
    18.  
    19. Err:
    20.    If Err.Number = 462 then
    21.         Exit Function
    22.    Else
    23.         Resume Next
    24.    End If
    25. End Function
    26.  
    27.  
    28. Public Sub CheckRunning()
    29.     On Error GoTo errhand
    30.     Dim strComputer, strProcess
    31.     lstPrograms.Clear
    32.     strComputer = lstComputers.Text
    33.  
    34. [I]'Check for notepad[/I]
    35.  
    36.     strProcess = "notepad.exe"
    37.     If (IsProcessRunning(strComputer, strProcess) = True) Then
    38.         lstPrograms.AddItem "Notepad" & " " & "is running"
    39.     Else
    40.         lstPrograms.AddItem "Notepad" & " " & "is Not running"
    41.     End If
    42.  
    43. [I]'Check for Calc[/I]
    44.  
    45.    strProcess = "calc.exe"
    46.     If (IsProcessRunning(strComputer, strProcess) = True) Then
    47.         lstPrograms.AddItem "Calculator" & " " & "is running"
    48.     Else
    49.         lstPrograms.AddItem "Calculator" & " " & "is Not running"
    50.     End If
    51.  
    52.     Exit Sub
    53. Errhand:
    54.     Exit Sub
    55.  
    56. End Sub

    Thanks again for all the help, I appreciate it.
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  12. #12

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    I still can't get this to work.

    The error traping doesn't seem to want to work until after it has looped through the error several times.

    Thanks again for the help
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  13. #13

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Anybody been able to figure this out? I still can't get it.

    I posted this on the MSDN forums. I was suggessted to ping the machine to see if it is available, but that still doesn't help.

    All I want is for it to move to the next machine upon error.

    Thanks
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  14. #14
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Need Help - running process on remote machine

    You would have to ping the machine, and parse the file to see if it communicated or not. This will capture the results of a PING command

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
    4. ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    5.  
    6. Private Const SW_SHOWNORMAL As Long = 1
    7. Private Const SW_HIDE As Long = 0
    8.  
    9. Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
    10.  
    11. Dim sSave As String, Ret As Long
    12.  
    13. Private Sub Form_Load()
    14.     'KPD-Team 1998
    15.     'URL: [url]http://www.allapi.net/[/url]
    16.     'E-Mail: [email][email protected][/email]
    17.     Dim sSave As String, Ret As Long
    18.     'Create a buffer
    19.     sSave = Space(255)
    20.     'Get the system directory
    21.     Ret = GetSystemDirectory(sSave, 255)
    22.     'Remove all unnecessary chr$(0)'s
    23.     sSave = Left$(sSave, Ret)
    24. End Sub
    25.  
    26. Private Sub Command1_Click()
    27.     ShellExecute Me.hwnd, "Open", sSave & "CMD.exe", " /c PING 191.168.1.100 > D:\Myfile.txt", "D:\", SW_SHOWNORMAL
    28. End Sub

    Then you could simply exit the function. I would use a flag to let you know the results, so you could return it to the calling function.

  15. #15

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Thank you for that information.

    This isn't the method I am using though. It's not just finding out if the machine is available. I know how to do that.

    Here's the scenario... I work for a company that has 80 locations connected via WAN. I am the network admin on 1 location. I do not have access to the other locations, although I can see their systems on the network. If I am running the function I listed above and click their machine, it crashes because I do not have rights to it. Same goes if the machine is off.

    What I need is to know how to get it to stop trying to connect to it if I don't have rights or if the machine is off.

    In other words, How do I code the function/sub above so that, upon an error...it will exit the sub. I tried the method in #11 above but couldn't get it to work.

    Can someone please help me fix my code above so that it will stop executing upon an error?

    Thanks
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  16. #16
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Need Help - running process on remote machine

    Maybe you can use the DIR() command to generate an error if the drive cannot be accessed?

  17. #17

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Quote Originally Posted by dglienna
    Maybe you can use the DIR() command to generate an error if the drive cannot be accessed?

    Can you explain please? Will this be able to stop the running of the Function/Sub I have listed above if the remote machine is unaccessible?

    Thanks
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  18. #18
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Need Help - running process on remote machine

    I tried this and got a Bad Filename or number error when I wasn't connected, but after I connected, it wouldn't return anything either. Maybe you could map a drive?

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. Dim str$
    5. On Error GoTo badfile
    6.   str = Dir("\\192.168.1.100\c550\*.*")
    7.   MsgBox str
    8.   Exit Sub
    9. badfile:
    10.   MsgBox Err.Description
    11. End Sub

    Hmm. It does work if I use a machine name instead of IP address. But doesn't crash if I substitute a server name that doesn't exist.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. Dim str$
    5. On Error GoTo badfile
    6.   str = Dir("\\w2k\c550\*.*")
    7.   MsgBox str
    8.   Exit Sub
    9. badfile:
    10.   MsgBox Err.Description
    11. End Sub

  19. #19

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Ok...I don't need to map to the computer.

    My program has a module that lists all the pc's connected to my network. I click one and it tells me if certain processes are running. Thats all.

    check out post #11 above and see if you can get that code to work upon an error.

    Thanks
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  20. #20
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Need Help - running process on remote machine

    I get a "Permission denied" error from my W2K Workstation. Maybe it's NAV, I'm not sure. I have logged on. I think I'm an admin with this account. Have to check in the morning. I still think that trying to read the hard drive would be a trappable error if the machine is offline. It's a shame that it doesn't work with an IP address.

  21. #21
    Fanatic Member
    Join Date
    Jan 2005
    Location
    In front of this pc.
    Posts
    580

    Re: Need Help - running process on remote machine

    If you don't have any 9x PCs on the network I think that the NetWkstaGetInfo API might give you what you need.

    VB Code:
    1. Private Declare Function NetWkstaGetInfo Lib "netapi32" ( _
    2.     ByVal servername As String, ByVal level As Long, lpBuf As Any) As Long
    3. ' example call - replace "Computername" with the actual PC name
    4. ' successfull call return 0
    5. lResult = NetWkstaGetInfo(StrConv("\\" & Computername, vbUnicode), 102, pWrkInfo)

    For more info see http://msdn.microsoft.com/library/de...stagetinfo.asp

  22. #22

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Quote Originally Posted by anotherVBnewbie
    If you don't have any 9x PCs on the network I think that the NetWkstaGetInfo API might give you what you need.

    VB Code:
    1. Private Declare Function NetWkstaGetInfo Lib "netapi32" ( _
    2.     ByVal servername As String, ByVal level As Long, lpBuf As Any) As Long
    3. ' example call - replace "Computername" with the actual PC name
    4. ' successfull call return 0
    5. lResult = NetWkstaGetInfo(StrConv("\\" & Computername, vbUnicode), 102, pWrkInfo)

    For more info see http://msdn.microsoft.com/library/de...stagetinfo.asp

    I'm willing to try this..but as I stated above, how do I code this so that when it tries connecting a machine that I do not have access to or that is off, it will stop the loop?

    The code I listed to start with works perfectly, except under those conditions. I need to know how to get it to stop the function upon error.

    Thank you everyone for your help, but I don't have a problem accessing the machine...I can do that just fine...I just need to know how to error trap my code above.

    Thanks again
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  23. #23
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Need Help - running process on remote machine

    Quote Originally Posted by capp
    The problem I am also having is, the script I run to list all PC's on my network, lists the ones that are powered off as well.
    This seems to be the problem. If it is listing machines that are off, then you have to check to see if the machine is off or not. It's been suggested that you try Pinging the machines, and I found that you can trap a Dir() error if you know the machine name. It takes a few seconds, but doesn't crash. If you can't read from a drive, then you should take the machine out of the list.

  24. #24

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Quote Originally Posted by dglienna
    This seems to be the problem. If it is listing machines that are off, then you have to check to see if the machine is off or not. It's been suggested that you try Pinging the machines, and I found that you can trap a Dir() error if you know the machine name. It takes a few seconds, but doesn't crash. If you can't read from a drive, then you should take the machine out of the list.

    Ok, I'm willing to try this. But it doesn't help with the second problem. As I stated, my network is part of a WAN. I have admin rights to my location, but not to others. The script lists all the pcs on the network, even the other locations because it does it via DNS.

    How can I get this to halt if the machine is on, but I don't have access to it?

    Thanks again for the help
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  25. #25
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Need Help - running process on remote machine

    Dir("\\w2k\c550\*.txt") came up with a bad file name or number when I changed the servername.

    It takes a few seconds, but it doesn't crash the program.

  26. #26

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Quote Originally Posted by dglienna
    Dir("\\w2k\c550\*.txt") came up with a bad file name or number when I changed the servername.

    It takes a few seconds, but it doesn't crash the program.
    What does this mean? I'm still going to get an error when I try to connect to a system I don't have access to.

    All I want to know is how to correct mine so it will stop processing when it hits an error.
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  27. #27
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Need Help - running process on remote machine

    You can trap this error with an On Error statement, and take it out of the list if you cannot connect. Then run your script on the ones that you can connect to. Sorry if I didn't explain myself very well before.

  28. #28
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Need Help - running process on remote machine

    FWIW, here is the script that scriptomatic2 wrote:
    It doesn't crash if I use an invalid server. Maybe you can edit it to get what you need istead of using your script? I see that it adds a couple of flags.

    VB Code:
    1. On Error Resume Next
    2.  
    3. Const wbemFlagReturnImmediately = &h10
    4. Const wbemFlagForwardOnly = &h20
    5.  
    6. arrComputers = Array("Laptop.") ' Comma delimited list of strings
    7. For Each strComputer In arrComputers
    8.    WScript.Echo
    9.    WScript.Echo "=========================================="
    10.    WScript.Echo "Computer: " & strComputer
    11.    WScript.Echo "=========================================="
    12.  
    13.    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
    14.    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Process", "WQL", _
    15.                                           wbemFlagReturnImmediately + wbemFlagForwardOnly)
    16.  
    17.    For Each objItem In colItems
    18.       WScript.Echo "Caption: " & objItem.Caption
    19.       WScript.Echo "CommandLine: " & objItem.CommandLine
    20.       WScript.Echo "CreationClassName: " & objItem.CreationClassName
    21.       WScript.Echo "CreationDate: " & WMIDateStringToDate(objItem.CreationDate)
    22.       WScript.Echo "CSCreationClassName: " & objItem.CSCreationClassName
    23.       WScript.Echo "CSName: " & objItem.CSName
    24.       WScript.Echo "Description: " & objItem.Description
    25.       WScript.Echo "ExecutablePath: " & objItem.ExecutablePath
    26.       WScript.Echo "ExecutionState: " & objItem.ExecutionState
    27.       WScript.Echo "Handle: " & objItem.Handle
    28.       WScript.Echo "HandleCount: " & objItem.HandleCount
    29.       WScript.Echo "InstallDate: " & WMIDateStringToDate(objItem.InstallDate)
    30.       WScript.Echo "KernelModeTime: " & objItem.KernelModeTime
    31.       WScript.Echo "MaximumWorkingSetSize: " & objItem.MaximumWorkingSetSize
    32.       WScript.Echo "MinimumWorkingSetSize: " & objItem.MinimumWorkingSetSize
    33.       WScript.Echo "Name: " & objItem.Name
    34.       WScript.Echo "OSCreationClassName: " & objItem.OSCreationClassName
    35.       WScript.Echo "OSName: " & objItem.OSName
    36.       WScript.Echo "OtherOperationCount: " & objItem.OtherOperationCount
    37.       WScript.Echo "OtherTransferCount: " & objItem.OtherTransferCount
    38.       WScript.Echo "PageFaults: " & objItem.PageFaults
    39.       WScript.Echo "PageFileUsage: " & objItem.PageFileUsage
    40.       WScript.Echo "ParentProcessId: " & objItem.ParentProcessId
    41.       WScript.Echo "PeakPageFileUsage: " & objItem.PeakPageFileUsage
    42.       WScript.Echo "PeakVirtualSize: " & objItem.PeakVirtualSize
    43.       WScript.Echo "PeakWorkingSetSize: " & objItem.PeakWorkingSetSize
    44.       WScript.Echo "Priority: " & objItem.Priority
    45.       WScript.Echo "PrivatePageCount: " & objItem.PrivatePageCount
    46.       WScript.Echo "ProcessId: " & objItem.ProcessId
    47.       WScript.Echo "QuotaNonPagedPoolUsage: " & objItem.QuotaNonPagedPoolUsage
    48.       WScript.Echo "QuotaPagedPoolUsage: " & objItem.QuotaPagedPoolUsage
    49.       WScript.Echo "QuotaPeakNonPagedPoolUsage: " & objItem.QuotaPeakNonPagedPoolUsage
    50.       WScript.Echo "QuotaPeakPagedPoolUsage: " & objItem.QuotaPeakPagedPoolUsage
    51.       WScript.Echo "ReadOperationCount: " & objItem.ReadOperationCount
    52.       WScript.Echo "ReadTransferCount: " & objItem.ReadTransferCount
    53.       WScript.Echo "SessionId: " & objItem.SessionId
    54.       WScript.Echo "Status: " & objItem.Status
    55.       WScript.Echo "TerminationDate: " & WMIDateStringToDate(objItem.TerminationDate)
    56.       WScript.Echo "ThreadCount: " & objItem.ThreadCount
    57.       WScript.Echo "UserModeTime: " & objItem.UserModeTime
    58.       WScript.Echo "VirtualSize: " & objItem.VirtualSize
    59.       WScript.Echo "WindowsVersion: " & objItem.WindowsVersion
    60.       WScript.Echo "WorkingSetSize: " & objItem.WorkingSetSize
    61.       WScript.Echo "WriteOperationCount: " & objItem.WriteOperationCount
    62.       WScript.Echo "WriteTransferCount: " & objItem.WriteTransferCount
    63.       WScript.Echo
    64.    Next
    65. Next
    66.  
    67. Function WMIDateStringToDate(dtmDate)
    68. WScript.Echo dtm:
    69.     WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
    70.     Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
    71.     & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
    72. End Function

  29. #29

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Quote Originally Posted by dglienna
    You can trap this error with an On Error statement, and take it out of the list if you cannot connect. Then run your script on the ones that you can connect to. Sorry if I didn't explain myself very well before.
    Thats the problem I've been trying to get solved. I have tried doing an On Error statement (look at #11 post on this thread) and it doesn't work.
    This is what I've been asking for, someone to look at the code I have in #11 and tell me what I've done wrong. I just need to be able to do this:

    On Error GoTo Err:

    Err:
    Exit function
    'continue loop


    The code you listed above is very similar to what I have. I will take a look at it and see if I can use it.

    Thank You
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  30. #30

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Ok...Update.

    I tried the code you listed above with the same results. I figured out what is going on.

    The attached picture shows the message I get if I do anything at all while the script is running. I found that if I let it sit there and process, it completes ok or at least stops running.

    The code I originally listed works just fine as well.

    Now what I need help with is, How can I present this so that it will not give me this message if the user decides to click around while it is processing?

    Thank You for your help.
    Attached Images Attached Images  
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  31. #31
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Need Help - running process on remote machine

    You want to block user input?

  32. #32

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Quote Originally Posted by dglienna
    You want to block user input?

    No, I just want to know how to keep the message I posted above from coming up. Can anyone show me how to keep this from popping up?

    Thanks
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  33. #33

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Now you can see why i'm having so many problems. The code works just fine, I just don't know how to keep that message from popping up.

    Anybody have any ideas please
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  34. #34

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Nobody figured it out yet?

    I am completely stumped. If nobody here has any ideas, does anybody know of any other support forums I could post at to see if I can get some help.

    I tried MSDN newsgroups, but didn't get any help there either.

    This is just frustrating, I never can seem to get my questions answered about VB.
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  35. #35

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Need Help - running process on remote machine

    Somebody has to know how to help me.

    As many people as are on this forum, somebody must know a link or article or something.

    Please
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  36. #36
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Need Help - running process on remote machine

    I built that script using Scriptomatic2. I think they have a forum. Some M$ guys developed it, and have a few scripts on the web site. Maybe you can get some help there?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width