jakalspop Posted June 23, 2011 Posted June 23, 2011 how to use _WinAPI_ShellGetSpecialFolderPath($CSIDL_COMPUTERSNEARME) to get all computers name are connected to local computer
PsaltyDS Posted June 23, 2011 Posted June 23, 2011 Do you understand that returns a PIDL? If you don't know what that is, this is not the function you were looking for. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
jakalspop Posted June 24, 2011 Author Posted June 24, 2011 OK you now know what is my mistake. let me re write my question. how to get all computers name are connected to local computer ?
water Posted June 24, 2011 Posted June 24, 2011 how to get all computers name are connected to local computer ?What do you mean by "connected to local computer"? Do you want to get all computer names in the LAN? 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
water Posted June 24, 2011 Posted June 24, 2011 (edited) Something like "net view"? Start a windows command prompt and enter "new view". If this is what you need you could use "run" and redirection to capture the results of "net view". Edited June 24, 2011 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
jakalspop Posted June 24, 2011 Author Posted June 24, 2011 it just get local computer name \\(user)-(computer name)
water Posted June 24, 2011 Posted June 24, 2011 (edited) For me it's not clear what you want to achieve. First we need to know which results you need to have; then a technical implementation can be created. Do you want to get all computers that are defined in an Active Directory domain, all computers that are logged on ...? Please be as specific as possible. Edited June 24, 2011 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
jakalspop Posted June 24, 2011 Author Posted June 24, 2011 here Example in C# expandcollapse popup1. /// <summary> 2. /// method for getting workgroup/domain name of system 3. /// </summary> 4. /// <returns></returns> 5. public static string GetWorkgroupName() 6. { 7. SelectQuery searchQuery = new SelectQuery("Win32_ComputerSystem"); 8. string name = string.Empty; 9. ManagementObjectSearcher searchObj = new ManagementObjectSearcher(searchQuery); 10. 11. //loop through each object that is returned 12. foreach (ManagementObject obj in searchObj.Get()) 13. //if it doesnt contain a partofdomain property 14. //then it's a Workgroup, otherwise it's a Domain 15. if ((bool)obj["partofdomain"] != true) 16. name = string.Format("Workgroup: {0} ", obj["workgroup"]); 17. else 18. name = string.Format("Domain: {0} ", obj["workgroup"]); 19. 20. return name; 21. }
water Posted June 24, 2011 Posted June 24, 2011 (edited) As you are going to use WMI you could give the AutoIt implementation of a try.It generates AutoIt code which can be adopted by you.Run ScriptOMatic.au3, wait till the WMI Namespace and WMI Class have been collected and then select WMI class "Win32_ComputerSystem".The resulting AutoIt code is the equivalent of your C# code. Edited June 24, 2011 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
jakalspop Posted June 24, 2011 Author Posted June 24, 2011 G:\scriptomatic.au3 (333) : ==> The requested action with this object has failed.: $objClass = $objWMIService.Get($strSelectedClass) $objClass = $objWMIService.Get($strSelectedClass)^ ERROR
water Posted June 25, 2011 Posted June 25, 2011 When does the error occur? After you start ScriptOMatic or after you select WMI class "Win32_ComputerSystem"? 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
jakalspop Posted June 25, 2011 Author Posted June 25, 2011 After select WMI class "Win32_ComputerSystem"
water Posted June 25, 2011 Posted June 25, 2011 Could you please check if the WMI service is running correctly? Here you find a description how to do it. 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
jakalspop Posted June 26, 2011 Author Posted June 26, 2011 work but did not get any computer in workgroup
water Posted June 26, 2011 Posted June 26, 2011 The AutoIt script created by ScriptOMatic does exactly what the C# example code does: determine if the computer is a domain or workgroup member.So what's missing is code to list all computers and then determine their status.Do I understand you correctly that you might have a mixture of domain and workgroup computers in your network? So you can't just query the Active Directory and then check if the machines are switched on?If yes you have to use something like "net view". Check this - quite old - to see how it can be done. 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
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