microera Posted December 12, 2015 Share Posted December 12, 2015 Hi I have 2 PCs on local LAN! We start one programm.exe from 1st or 2nd computer!But at same time must be running ONLY one process (programm.exe)! How to detect process on another PC? Link to comment Share on other sites More sharing options...
water Posted December 12, 2015 Share Posted December 12, 2015 (edited) You could use WMI to get a list of processes. The example script "Scriptomatic" creates AutoIt code for you.The following stripped down example returns a list of processes running on the other computer. Replace "." with the name of this computer.; Generated by AutoIt Scriptomatic #include <Array.au3> Global $wbemFlagReturnImmediately = 0x10 Global $wbemFlagForwardOnly = 0x20 Global $colItems = "" Global $strComputer = "." Global $i = 0 Global $aResult[10000] $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Process", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $aResult[$i] = $objItem.Caption $i = $i + 1 Next ReDim $aresult[$i] _ArrayDisplay($aResult) Else MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_Process") EndIf Edited December 13, 2015 by water microera 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
microera Posted December 13, 2015 Author Share Posted December 13, 2015 very good "water"!!And how send pop up message from Computer1 to Computer2 if I try run PROGRAMM.EXE from Computer1?(in example detecting running PROGRAMM.EXE in Computer2)Possible also with WMI? Or I need any other service?! Link to comment Share on other sites More sharing options...
water Posted December 13, 2015 Share Posted December 13, 2015 You want to start from Computer 1 a program on Computer 2? Then PSExec seems to be the tool for you. microera 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
microera Posted December 13, 2015 Author Share Posted December 13, 2015 You could use WMI to get a list of processes. The example script "Scriptomatic" creates AutoIt code for you.The following stripped down example returns a list of processes running on the other computer. Replace "." with the name of this computer.; Generated by AutoIt Scriptomatic #include <Array.au3> Global $wbemFlagReturnImmediately = 0x10 Global $wbemFlagForwardOnly = 0x20 Global $colItems = "" Global $strComputer = "." Global $i = 0 Global $aResult[10000] $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Process", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $aResult[$i] = $objItem.Caption $i = $i + 1 Next ReDim $aresult[$i] _ArrayDisplay($aResult) Else MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_Process") EndIf On home computer work ok but on my Office computer:>Running:(3.3.12.0):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\UPRAVLJAJ\wmi_lan_process_get.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop"C:\UPRAVLJAJ\wmi_lan_process_get.au3" (40) : ==> Variable must be of type "Object".:$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Process", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)$colItems = $objWMIService^ ERROR->14:14:22 AutoIt3.exe ended.rc:1+>14:14:22 AutoIt3Wrapper Finished.>Exit code: 1 Time: 0.6572Where is a problem? Link to comment Share on other sites More sharing options...
water Posted December 13, 2015 Share Posted December 13, 2015 Please add a COM error handler to the script so we can see why ObjGet doesn't return an object. Please see ObjEvent in the help file for an example. microera 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
microera Posted December 13, 2015 Author Share Posted December 13, 2015 from 1st example:https://www.autoitscript.com/autoit3/docs/functions/ObjEvent.htm Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") and; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc and get:>Running:(3.3.12.0):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\UPRAVLJAJ\wmi_lan_process_get.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stopwmi_lan_process_get.au3 (41) : ==> COM Error intercepted ! err.number is: 0x80070005 err.windescription: Dostop je zavrnjen. err.description is: err.source is: err.helpfile is: err.helpcontext is: err.lastdllerror is: 0 err.scriptline is: 41 err.retcode is: 0x00000000wmi_lan_process_get.au3 (42) : ==> COM Error intercepted ! err.number is: 0x000000A9 err.windescription: Variable must be of type 'Object'. err.description is: err.source is: err.helpfile is: err.helpcontext is: err.lastdllerror is: 0 err.scriptline is: 42 err.retcode is: 0x00000000+>14:47:38 AutoIt3.exe ended.rc:0+>14:47:38 AutoIt3Wrapper Finished.>Exit code: 0 Time: 21.05 Link to comment Share on other sites More sharing options...
water Posted December 13, 2015 Share Posted December 13, 2015 Google translate tells me that the first message means: Access is denied.Maybe this site describes what's going on. microera 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted December 13, 2015 Share Posted December 13, 2015 This site (https://msdn.microsoft.com/en-us/library/windows/desktop/aa394603(v=vs.85).aspx) is even more specific how to solve the problem. Search for "0x80070005" microera 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
microera Posted December 13, 2015 Author Share Posted December 13, 2015 Access is denied solved ......... but:now:--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stopwmi_lan_process_check.au3 (41) : ==> COM Error intercepted ! err.number is: 0x800706BA err.windescription: Strežnik za RPC ni na voljo. err.description is: err.source is: err.helpfile is: err.helpcontext is: err.lastdllerror is: 0 err.scriptline is: 41 err.retcode is: 0x00000000 Link to comment Share on other sites More sharing options...
microera Posted December 13, 2015 Author Share Posted December 13, 2015 I'm enable this:https://support.software.dell.com/enterprise-reporter/kb/116792Windows 8 and Windows 8.1In the lower left hand corned of the screen right click and select Control Panel. Then select System and Security | Windows Firewall then select “Allow an app or feature through Windows Firewall”. Scroll down and click on check box next to “File and Printer Sharing” and “Windows Management Instrumentation (WMI)” which should automatically select the check box in the Domain column. Click OK. Next start the Remote Registry service which is set to Disabled by default (set to Automatic). If not data such as installed software, event logs, security policies, etc. will not be retrieved. but still same problem! Link to comment Share on other sites More sharing options...
water Posted December 13, 2015 Share Posted December 13, 2015 (edited) 0x800706BA stands for: RPC server is unavailable.This site describes a few other possible causes for your problem. Edited December 13, 2015 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
microera Posted December 15, 2015 Author Share Posted December 15, 2015 This site (https://msdn.microsoft.com/en-us/library/windows/desktop/aa394603(v=vs.85).aspx) is even more specific how to solve the problem. Search for "0x80070005"..again I have this error: 0x80070005Is possible with command lines setting WMI or access from comp1 <--> comp2?p.s.I have win 8.1 p.s.2I'm disable firewall but still same problem! Link to comment Share on other sites More sharing options...
water Posted December 15, 2015 Share Posted December 15, 2015 Can't you talk to your network/computer admins and ask them for assistance? Helping with a problem I do not see here is a bit hard.I'm sure it is a problem with firewall, GPOs or whatever and the admins know what they have changed on their systems. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
argumentum Posted December 15, 2015 Share Posted December 15, 2015 I have 2 PCs on local LAN! We start one programm.exe from 1st or 2nd computer!But at same time must be running ONLY one process (programm.exe)! How to detect process on another PC?Since is your network, and you have access to both, I'd write something on UDP or TCP to announce it. Like a chat ( there are a lot of examples ) , because you are not limited to WMI.Now, why the WMI fails, no clue, it should work. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
orbs Posted December 16, 2015 Share Posted December 16, 2015 @microera,... must be running ONLY one process (programm.exe) ...why?most common cause is that they both access a shared resource (which may be sensitive to conflicts).if this is your case, then use this UDF. it was written for cases where the shared resource is a file, but can be used for other types of resources. you don't need access between computers; you just need both to have access to a shared folder, which can exist anywhere. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now