I have this script to check if a process is running. I can run the script and get the expected result (no match). If I compile and run, I get a result other than no match. I am attaching both debug files.
AddExtender("WWPRC44I.DLL")
AddExtender("WWWNT34I.DLL")
;IntControl(12,5,0,0,0) ; Terminate silently
;ErrorMode(@OFF)
DebugTrace(@on,"C:\temp\comp-trace.log")
username=wntGetUser(@default)
id=tListProc()
start = 1
daend = StrIndexNC(id, "mct", start, @FWDSCAN)
message ("info", daend)
If daend == 0
exit
Else
COMSPEC = Environment("COMSPEC")
runwait (COMSPEC, "/c shutdown /a")
;Write message to EventLog
;Type Value
;0 SUCCESS
;1 ERROR
;2 WARNING
;4 INFORMATION
;8 AUDIT_SUCCESS
;16 AUDIT_FAILURE
msg = StrCat (username, " ", "Issued a MCT shutdown while running...")
WshShell = CreateObject("WScript.Shell")
WshShell.LogEvent(4, msg)
Message("Attention", "MCT is still running. MCT needs to exit before a shutdown ..")
EndIf
Try recompiling the script using the same manifest settings as the uncompiled script. Your uncompiled script is using HighestAvailable/True.
Same results ..
Ok the problem is the compiled exe (MCT shutdown script.exe) name contains the same keyword the script is looking for
daend = StrIndexNC(id, "mct", start, @FWDSCAN)
Rename the EXE to "shutdown script.exe". That should resolve the issue.