473,602 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

select directory on remote machine using WMI

Hi,

How can this be done? I've searched the internet for a solution to this
problem, and can't find a clear answer. I need to be able to browse a
remote computer's filesystem, using a certain user and password, and
select a storage location (for some files to be created later). I've
seen that WMI has Win32_Directory , but I don't know how find which
files are contained in a specific directory. I was thinking of using a
query select which would filter from all entries, only the ones that
are in a specific directory, but I don't know how. Is there
documentation for the WMI Query Language?

Hope someone can help...

Thanks in advance,
Cosmin.

Sep 18 '06 #1
4 7417

"CosminB [BRT]" <co*****@gmail. comwrote in message
news:11******** *************@k 70g2000cwa.goog legroups.com...
| Hi,
|
| How can this be done? I've searched the internet for a solution to this
| problem, and can't find a clear answer. I need to be able to browse a
| remote computer's filesystem, using a certain user and password, and
| select a storage location (for some files to be created later). I've
| seen that WMI has Win32_Directory , but I don't know how find which
| files are contained in a specific directory. I was thinking of using a
| query select which would filter from all entries, only the ones that
| are in a specific directory, but I don't know how. Is there
| documentation for the WMI Query Language?
|
| Hope someone can help...
|
| Thanks in advance,
| Cosmin.
|

The docs for WMI are in the Platform SDK documnetation and in the MSDN
library.
Question is why you want to use WMI for this?

Willy.
Sep 18 '06 #2
I thought this is the way to go... any other ideas?

Willy Denoyette [MVP] wrote:
"CosminB [BRT]" <co*****@gmail. comwrote in message
news:11******** *************@k 70g2000cwa.goog legroups.com...
| Hi,
|
| How can this be done? I've searched the internet for a solution to this
| problem, and can't find a clear answer. I need to be able to browse a
| remote computer's filesystem, using a certain user and password, and
| select a storage location (for some files to be created later). I've
| seen that WMI has Win32_Directory , but I don't know how find which
| files are contained in a specific directory. I was thinking of using a
| query select which would filter from all entries, only the ones that
| are in a specific directory, but I don't know how. Is there
| documentation for the WMI Query Language?
|
| Hope someone can help...
|
| Thanks in advance,
| Cosmin.
|

The docs for WMI are in the Platform SDK documnetation and in the MSDN
library.
Question is why you want to use WMI for this?

Willy.
Sep 18 '06 #3

"CosminB [BRT]" <co*****@gmail. comwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.com...
|I thought this is the way to go... any other ideas?

No, this is one way to go but maybe not the best.
The DirectoryInfo class accepts a UNC path like \\\\MyServer\\M yShare, so
you may use this one to connect/access a remote share or drive. Sure you
need access privileges to the remote resource, but this can be achieved by
1) impersonation or 2) by establishing a network session with the resource.
Option 2 is simple, just issue a 'net use ...' command (from the commandline
or using Process.Start), specifying the network path and the credentials
needed. Option 1 is more involving and wight not work if the client is
running W2K, basically you have to retrieve an access token by calling
LogonUser through PInvoke specifying the credentials for which you want to
obtain a token, use this token to Impersonate. Search MSDN for a sample
(look for LogonUser).

Willy.


Sep 18 '06 #4
Willy Denoyette [MVP] wrote:
"CosminB [BRT]" <co*****@gmail. comwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.com...
|I thought this is the way to go... any other ideas?

No, this is one way to go but maybe not the best.
The DirectoryInfo class accepts a UNC path like \\\\MyServer\\M yShare, so
you may use this one to connect/access a remote share or drive. Sure you
need access privileges to the remote resource, but this can be achieved by
1) impersonation or 2) by establishing a network session with the resource.
Option 2 is simple, just issue a 'net use ...' command (from the commandline
or using Process.Start), specifying the network path and the credentials
needed. Option 1 is more involving and wight not work if the client is
running W2K, basically you have to retrieve an access token by calling
LogonUser through PInvoke specifying the credentials for which you want to
obtain a token, use this token to Impersonate. Search MSDN for a sample
(look for LogonUser).

Willy.
I need to be sure it works on W2K also. As for option 2, I need to be
able to select any drive the remote host has... anyway, I've found a
way, with WMI, like this:

SELECT * FROM CMI_LogicalFile WHERE Path="\\somepat h\\" AND Drive="X:"

and the drives, I get them with:

SELECT * FROM CMI_LogicalDisk

I don't mind doing a little extra work, but this seems fine, I hope it
will work well.

Thanks for the quick replies,
Cosmin.

Sep 18 '06 #5

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

Similar topics

7
12111
by: iqbal | last post by:
Hi all, We have an application through which we are bulk inserting rows into a view. The definition of the view is such that it selects columns from a table on a remote server. I have added the servers using sp_addlinkedserver on both database servers. When I call the Commit API of oledb I get the following error: Error state: 1, Severity: 19, Server: TST-PROC22, Line#: 1, msg:
1
2173
by: Swarna | last post by:
Hi all, I am trying to find out whether a particular directory is present on a remote machine or not from my local Python script in Linux . Can anyone help me with the command that i need to issue to os.system in my python script to acheive this? Thanks, for all your time !
5
2484
by: Michael C | last post by:
....on a remote machine? Thanks, Michael C.
1
2376
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 to authenticate and maintain accounts in active directory. It all works fine when the web service is on the same machine as the domain controller but when the web service is on a remote machine it fails on any active directory calls. I have...
9
3166
by: Patrick | last post by:
I have an ASP.NET page that searches for someone in the corporate Active Directory. It had been working fine until recently when I changed from Basic Authentication on IIS6 back to Integrated Windows authentication. The error occurs on the FindAll method. The exceptions are as follows. anyway of getting the code working with Integrated Windows authentication (too annoying for user to enter user-name/password). Note I do need to use...
11
29824
by: Steve Franks | last post by:
I'm using VS.NET 2005 Beta 2. I have a helper C# class I wrote that I placed in my /App_Code directory. Everything runs fine locally. However when I use the "Copy Web" function to upload the site to the production server, I get the following error when trying to run the page on production: "System.Web.HttpException: The directory '/App_Code' is not allowed because the application is precompiled." Anyone know this works fine locally but...
2
2256
by: enrique | last post by:
Hello everyone, I'm looking for a "directory path" solution that will allows me to test my app locally and then test on remote web server without having to update my web.config file each time I modify the file. In other words I'm storing the paths (for centralizing purposes) as custom <appSettings> in the web.config. expample (for local testing): <add key="imagePath" value="http://localhost/app_folder/10_media/images/" />
1
1845
by: jyohere | last post by:
How to access a remote machine directory from a local machine....I tried something like this: opendir(DIR,"192.168.9.62:/home/cygnet/Marconi_PM_Simulator/conf/"); @files = readdir(DIR); closedir(DIR); 192.168.9.62 is the remote machine.....how can i do this..pls help me...
2
4112
by: sbettadpur | last post by:
hello everybody, i need a small script that should read the directories of remote machine which is in LAN. i tried with function called "opendir". but this fill read only local machine directories, whereas i want remote machine directory files. Please if anybody knows about this, reply me thanks
0
7993
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7920
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8268
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.