Option Explicit Dim Title,ProcessPath,WshShell,wshNetwork,strUserName,UserName2Check Title = "Check for logged user" UserName2Check = "Administrator" 'Change this line to the name of the user to check Set wshNetwork = CreateObject( "WScript.Network" ) strUserName = wshNetwork.UserName MsgBox "The username " & DblQuote(strUserName) & " is logged in",vbInformation,Title ProcessPath = "C:\Program Files (x86)\Spark\Spark.exe" Set WshShell = CreateObject("WScript.Shell") If Ucase(strUserName) = UCase(UserName2Check) And CheckProcess(DblQuote(ProcessPath)) = False Then WshShell.Run ProcessPath End If '************************************************************************** Function CheckProcess(ProcessPath) Dim strComputer,objWMIService,colProcesses,Tab,ProcessName strComputer = "." Tab = Split(ProcessPath,"\") ProcessName = Tab(UBound(Tab)) ProcessName = Replace(ProcessName,Chr(34),"") Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = '"& ProcessName & "'") If colProcesses.Count = 0 Then CheckProcess = False Else CheckProcess = True End if End Function '************************************************************************** Function DblQuote(Str) DblQuote = Chr(34) & Str & Chr(34) End Function '**************************************************************************