bword
Member
- Reaction score
- 4
- Location
- Naugatuck, CT
I have a windows 10 laptop that will periodically get a prompt asking what to do with a .VBS file. I cant quite figure it out as I dont speak that language. This laptop is used for Auto body estimates and it appears to be connected with the VBS file. If I chose Notepad to open it I get this....
Im not sure what its looking for but im guessing something to do with "Connection.CollisionLink.Shop.TrayAgent.exe"
Code:
DIM WinScriptHost
DIM Fso
DIM Service
DIM WshShell
DIM Args
DIM continueExec
DIM argsLength
'Get Cmd Line Arguments
Set Args = WScript.Arguments
Set Fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
continueExec = False
' For Vista and greater, we pass in the clickonce link as an argument
argsLength = CStr(Args.Length)
if (argsLength = 0) Then
continueExec = True
Else
' A clickonce link was passed in thru Vista or greater
If (Fso.FileExists(Args(0))) Then
continueExec = True
End If
End If
if (continueExec) Then
'If Tray Agent is not running, launch
If isProcessRunning(".", "OEConnection.CollisionLink.Shop.TrayAgent.exe", WshShell.ExpandEnvironmentStrings("%USERNAME%")) = FALSE Then
Set WinScriptHost = CreateObject("WScript.Shell")
'Change the current working directory to where this running script is
WinScriptHost.CurrentDirectory = Left(Wscript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\"))
'Run tray agent exe only if the .exe can be found.
'Will update itself at 10 am.
If (Fso.FileExists("OEConnection.CollisionLink.Shop.TrayAgent.exe")) Then
WinScriptHost.Exec("OEConnection.CollisionLink.Shop.TrayAgent.exe")
End If
End If
End If
FUNCTION isProcessRunning(ByRef strComputer, ByRef strProcess, ByRef strUserName)
DIM objWMIService, strWMIQuery, objProcess, strOwner, Response
strWMIQuery = "SELECT * FROM Win32_Process WHERE NAME = '" & strProcess & "'"
SET objWMIService = GETOBJECT("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2").ExecQuery(strWMIQuery)
IF objWMIService.Count > 0 THEN
For Each objProcess in objWMIService
Response = objProcess.GetOwner(strOwner)
If Response = 0 Then
If strUserName = strOwner Then
isProcessRunning = TRUE
Else
'do nothing as you only want to detect the current user running it
isProcessRunning = FALSE
End If
End If
Next
ELSE
isProcessRunning = FALSE
END If
End Function
Set Args = Nothing
Set WinScriptHost = Nothing
Set Fso = Nothing
Set WshShell = Nothing
Im not sure what its looking for but im guessing something to do with "Connection.CollisionLink.Shop.TrayAgent.exe"