none
Aplication not running in script vbs. RRS feed

  • Pergunta

  • Hi,

    I have the following script:


    On Error Resume Next

    blnRunningProgramFound = False

    For Each Process In GetObject ("winmgmts:"). InstancesOf _
         
    (Win32_Process)
         
    If process.Name = "TotvsSmartClient.exe" Then
            
    'Program found
            
    blnRunningProgramFound = True
        
    End If
    Next

    If blnRunningProgramFound = False Then
     
    Set WshShell = CreateObject ("WScript.Shell")
     
    WshShell.Run "c: \ Protheus 10 \ bin \ SmartClient \ TotvsSmartClient.exe"

    End If

    strComputer = "."
    Set objWMIService = GetObject ("winmgmts:" _
    & "(ImpersonationLevel = impersonate)! \ \" & StrComputer & "\ root \ cimv2")

    Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'TotvsSmartClient.exe' and ProcessID ProcessID =)

    WScript.Sleep 120000

    For Each objProcess in colProcessList
    objProcess.Terminate ()
    Next

    It works normally with other application but when I try to run with a particular application does not work. I usually run this particular application where it is installed and its mapping in the script is correct.
    I run this script in Windows Server 2008.

    quinta-feira, 29 de julho de 2010 19:38