ur Posted September 26, 2017 Posted September 26, 2017 With ProcessList ( ["name"] ) we are able to get the running process list from the local machine. Is there anyway to get the list from Remote machine, more precisely to get to know the status whether a particular application is running or not on remote machine using AutoIT? We can implement through PSList.exe, but again we need to parse the text of it to read the output. Is there any direct UDF in AutoIT?
Gianni Posted September 26, 2017 Posted September 26, 2017 a way by using WMI. #include <array.au3> _ArrayDisplay(_GetTaskList()) ; Pass the target computer name for remote clients Func _GetTaskList($strComputer = @ComputerName) If Not Ping($strComputer) Then Return SetError(1, 0, "") Local $usr = "", $pass = ""; set this only if different from current user ; https://msdn.microsoft.com/en-us/library/aa394372(v=vs.85).aspx Local $objWMILocator = ObjCreate("WbemScripting.SWbemLocator") Local $objWMIService = $objWMILocator.ConnectServer($strComputer, "\root\cimv2", $usr, $pass, "", "", "&H80") Local $colProcesses = $objWMIService.ExecQuery("SELECT * FROM Win32_Process") If Not IsObj($colProcesses) Then Return SetError(2, 0, "") Local $aProcesses[$colProcesses.count + 1][2] = [[$colProcesses.count, 0]] Local $i = 0 For $objProces In $colProcesses $i += 1 $aProcesses[$i][0] = $objProces.name $aProcesses[$i][1] = $objProces.ProcessID Next Return SetError(0, 0, $aProcesses) EndFunc ;==>_GetTaskList Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
jguinch Posted September 26, 2017 Posted September 26, 2017 (edited) @Chimp : "&H80" => 0x80 edit : I don't understand why it works with "&H80" ... Edited September 26, 2017 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Gianni Posted September 26, 2017 Posted September 26, 2017 @jguinch, seems that WMI is happy with the VB hex notation "&H80", while if you want to use the AutoIt hex notation 0x80 then pass it without quotes. If you use the decimal number 128 it's always ok with or without quotes. Local $objWMIService = $objWMILocator.ConnectServer($strComputer, "\root\cimv2", $usr, $pass, "", "", 0x80) or Local $objWMIService = $objWMILocator.ConnectServer($strComputer, "\root\cimv2", $usr, $pass, "", "", "128") or Local $objWMIService = $objWMILocator.ConnectServer($strComputer, "\root\cimv2", $usr, $pass, "", "", 128) Soa 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
ur Posted December 16, 2017 Author Posted December 16, 2017 with PSTools we are able to get the details. pslist.exe Usage: C:\Users\uday-\Desktop\pslist64.exe [-d][-m][-x][-t][-s [n] [-r n] [\\computer [-u username][-p password][name|pid] -d Show thread detail. -m Show memory detail. -x Show processes, memory information and threads. -t Show process tree. -s [n] Run in task-manager mode, for optional seconds specified. Press Escape to abort. -r n Task-manager mode refresh rate in seconds (default is 1). \\computer Specifies remote computer. -u Optional user name for remote login. -p Optional password for remote login. If you don't present on the command line pslist will prompt you for it if necessary. name Show information about processes that begin with the name specified. -e Exact match the process name. -nobanner Do not display the startup banner and copyright message. pid Show information about specified process. All memory values are displayed in KB. Abbreviation key: Pri Priority Thd Number of Threads Hnd Number of Handles VM Virtual Memory WS Working Set Priv Private Virtual Memory Priv Pk Private Virtual Memory Peak Faults Page Faults NonP Non-Paged Pool Page Paged Pool Cswtch Context Switches
water Posted December 16, 2017 Posted December 16, 2017 Correct: We are able to get the details using PSTools. But the question is: Do you need the details? If yes, which one? You didn't mention this in your originial post. 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
ur Posted December 16, 2017 Author Posted December 16, 2017 I just posted as one of the solutions to my question long back that I followed, so that if this approach is wrong, our members can correct me.
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