How can I access network shares and connections?

I am looking for a way to retrieve information similar to the following console applications remotely:

  • net use
  • net share
  • netstat -ano

However, I need to be able to do this without starting a third-party application on the system. This effectively eliminates the use of psexec to execute the command remotely because psexec will be installed as a service.

I must add that I have administrator credentials on the remote system. I considered using WMI for remote execution, but this requires that I write the output to a file and then extract it. It is possible, but I would like to know if anyone has a better way.

I am using Delphi 2010.

+3
source share
3 answers

There are several Delphi WMI components that allow remote access. However, I did not use remote options.

MagWmi - http://www.magsys.co.uk/delphi/magwmi.asp (support for Delphi 2010 and a free source)

WMISet / NTSet - http://www.online-admin.com/ntset.html (TNTShare Manages shared resources on the local computer and remote hosts. Using this component, you can change the list of shared devices, view files opened by remote users, observe and end the remote sessions open on the destination computer, change the list of mapped network drives. It's not free.)

GLibWMI. Torry.net, . ( Delphi 2010 Freeware ). , . .

,

+5

, Logman.
WMI.

GLibWMI - (http://neftali.clubdelphi.com) sourceforge (http://sourceforge.net/projects/glibwmi/).
1.8b SharedInfo, .
, , WMI.

.
P.D: .

+2

, NetShareEnum ( Jedi Apilib).

I suppose there must be an api for "network usage", but I never used it (check out the WNet features ). An alternative is to use the EnumNetworkDrives method of the WshNetwork com object.

As for netstat, I don’t think it can be done remotely (except for using some method to remotely start the process).

+1
source

Source: https://habr.com/ru/post/1742496/


All Articles