Sign in to follow this  
Followers 0
jakalspop

how to use _WinAPI_ShellGetSpecialFolderPath

17 posts in this topic

how to use _WinAPI_ShellGetSpecialFolderPath($CSIDL_COMPUTERSNEARME)

to get all computers name are connected to local computer

Share this post


Link to post
Share on other sites



Do you understand that returns a PIDL? If you don't know what that is, this is not the function you were looking for.

:huh2:


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

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

yes

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

it just get local computer name

\\(user)-(computer name)

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

OK

all computers that are logged on

Share this post


Link to post
Share on other sites

here Example in C#

1.
      /// <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.
      }

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

G:\scriptomatic.au3 (333) : ==> The requested action with this object has failed.:
$objClass = $objWMIService.Get($strSelectedClass)
$objClass = $objWMIService.Get($strSelectedClass)^ ERROR

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

After select WMI class "Win32_ComputerSystem"

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

work but did not get any computer in workgroup :);)

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0