473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to view the directory information of the neighbor computer

hi,everyone
I have a question about viewing the directory information of the remote
computer in the local network. I used the C# class: OpenFileDialog which can
not browse other computer's directory information. How can I view the whole
directory information of other computer given that I have one of its
administrator account. Could anyone help me? Thank you in advance.

Best Regard

Zeeway

May 25 '06 #1
10 5824
Hello, zeeway!

You can use WMI ( Win32_Directory ).
or
if you have admin account you can view contents of computers disk,
you access for instance disk C, you will use fillowing UNC path \\computername\C$

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
May 25 '06 #2
Thank you. I have tried the code:

ConnectionOptions Conn = new ConnectionOptions();
Conn.Username ="test";
Conn.Password ="123";
ManagementPath p = new ManagementPath("\\\\192.168.1.9\\root\\cimv2");
ManagementScope ms = new ManagementScope(p,Conn);
ObjectQuery oq = new ObjectQuery("SELECT * FROM Win32_LogicalDisk");
ManagementObjectSearcher link = new ManagementObjectSearcher(ms,oq);
ManagementObjectCollection queryCollection = link.Get();
foreach (ManagementObject dsk in Collection)
{
Console.Write(dsk["Caption"]);
}

It can help me accquire basic disk information on the remote computer, but
the directory and file information on a certain disk still can not be
abtained.
Can you give me a hand any more?
Best Regard

Zeeway

"Vadym Stetsyak" <va*****@ukr.net>
Hello, zeeway!

You can use WMI ( Win32_Directory ).
or
if you have admin account you can view contents of computers disk,
you access for instance disk C, you will use fillowing UNC path \\computername\C$
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com

May 31 '06 #3
Hello, zeeway!

z> It can help me accquire basic disk information on the remote computer,
z> but the directory and file information on a certain disk still can not
z> be abtained.

Why can't you use smth like this?
string [] fileEntries = Directory.GetFiles(\\servername\$C); //for disk C access
and the same for other disk in the system ( info about them can be obtained via WMI )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
May 31 '06 #4
Hello, Vadym!

z>> It can help me accquire basic disk information on the remote computer,
z>> but the directory and file information on a certain disk still can not
z>> be abtained.

VS> Why can't you use smth like this?
VS> string [] fileEntries = Directory.GetFiles(\\servername\$C); //for disk
VS> C access and the same for other disk in the system ( info about them
VS> can be obtained via WMI )

oops I meant
string [] fileEntries = Directory.GetFiles(\\servername\C$);


--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
May 31 '06 #5
Hi,
I'm sorry for answering you so late.
Following your advice,I can read the files information now. But if the
remote computer wants me to provide one account and its password to verify
whether I can visit it,Could you tell me where I can specifiy the account
and its password. Thanks a lot.

Best Regard

Zeeway
2006-06-05
Jun 5 '06 #6
Hello, zeeway!

z> Could you tell me where I can specifiy the account
z> and its password.

Before accessing remote resources, you have to do impersonation via LogonUser API.
Take a look at impersonation sample here ( http://www.codeproject.com/csharp/cpimpersonation1.asp )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Jun 5 '06 #7
Hi Vadym,
I tried LogonUser API with the demo as you told me,but I found that
LogonUser returns true when I specify a local user name and its password no
matter what domain I specified. So what does the domain parameter mean? When
the domain is a remote computer and the userName and its password belongs to
the remote computer, LoginUser return false.
Could you give me more detail about the usage of LogonUser?
Best Regard

Zeeway
2006-06-07
Jun 7 '06 #8
Hello, zeeway!

z> Hi Vadym,
z> I tried LogonUser API with the demo as you told me,but I found that
z> LogonUser returns true when I specify a local user name and its password
z> no matter what domain I specified. So what does the domain parameter
z> mean? When the domain is a remote computer and the userName and its
z> password belongs to the remote computer, LoginUser return false.
z> Could you give me more detail about the usage of LogonUser?
z> Best Regard

LogonUser returns security access token. This token is further used with impersonation.
Domain parameter is used if you want to obtain access token of the domain account.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Jun 7 '06 #9
Hi Vadym,
http://msdn.microsoft.com/library/de...us/secauthn/se
curity/logonuser.asp
It's said that :You cannot use LogonUser to log on to a remote computer.

Best Regard

Zeeway
06.06.08
Jun 8 '06 #10
That's the whole point, LogonUser is an API used to authenticate a user,
when authentication succeeds an "access token" is returned, this token can
further be used to impersonate, but this isn't the same as "log on" to a
remote computer.

Willy.

"zeeway" <ze****@gmail.com> wrote in message
news:er**************@TK2MSFTNGP03.phx.gbl...
| Hi Vadym,
|
http://msdn.microsoft.com/library/de...us/secauthn/se
| curity/logonuser.asp
| It's said that :You cannot use LogonUser to log on to a remote computer.
|
| Best Regard
|
| Zeeway
| 06.06.08
|
|
Jun 8 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: John Hunter | last post by:
I have a list of two tuples containing x and y coord (x0, y0) (x1, y1) ... (xn, yn) Given a new point x,y, I would like to find the point in the list closest to x,y. I have to do this a...
1
by: Moukarram Kabbash | last post by:
Hello everybody, how can I get the names of all neighbor computers in my local network ? Thanks in advance
0
by: Tomas Vera | last post by:
Hello All, I'm posting this for the benefit of the search engines. I've been developing web apps on my computer for about 18 months using VS2002. This morning, I was showing a colleague how to...
1
by: Ollie | last post by:
I know this has been asked before, I have read the answers given and I am unable to get this work ( I don't know that much about AD configuration) I have an asp.net web service that is designed...
46
by: Ian Boyd | last post by:
IIS5, on a Windows 2000 Server machine. Debeg.WriteLine "Hello, world!" How can i view it?
0
by: Chung Leong | last post by:
In this brief tutorial I'll describe how you retrieve information from an Active Directory through the OLE-DB extension. While it is possible to use the LDAP extension to achieve the same goal, as...
5
by: CBidwill | last post by:
Hello, I'm a ASP.NET developer with a little experience in IIS but I'm having difficulties getting a little ASP.NET application I wrote up on my home intranet. Here's the details: - I can view...
0
abdoelmasry
by: abdoelmasry | last post by:
hi profs i have PDC, i am trying to ad another domain in the same forest. i alway get his error : The operation failed because: Active Directory could not replicate the directory...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.