473,473 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Mapping of network drive does not get recognized by WMI?

My problem is that I want to set file permission on a file on the
network using WMI, but the folder might not be mapped which ,as far as
I know, WMI needs. So my solution to this would be to map the folder
in runtime, but for some reason WMI does not seem to get that I have
done the mapping. I still get a "Not Found" exeption. If I check the
mapping from within the code it exists.
Here is a part of the code I use.

Dim FileName as string = "Test.txt"
Dim UNC as string = Any UNC path
Dim Mapped as string

Mapped = 'Create a mapping to the UNC path

Console.Write(system.IO.Directory.Exists(Mapped))

Dim objFile As New ManagementObject(New
ManagementPath("Win32_LogicalfileSecuritySetting=' " + _
Mapped.Replace("\", "\\") + "'"))
Console.Write(objFile.GetText(TextFormat.Mof)) 'Here we get a "Not
Found" exieption

Thanks
Johan
Nov 20 '05 #1
1 4584
I tested this just now. Is this of help to you ?

Dim sinfo As New System.Diagnostics.ProcessStartInfo

sinfo.Arguments = "use P: \\client1\temp"

sinfo.FileName = "c:\windows\system32\net.exe"

System.Diagnostics.Process.Start(sinfo)

Regards - OHM

"Johan" <c_*************@hotmail.com> wrote in message
news:d2**************************@posting.google.c om...
My problem is that I want to set file permission on a file on the
network using WMI, but the folder might not be mapped which ,as far as
I know, WMI needs. So my solution to this would be to map the folder
in runtime, but for some reason WMI does not seem to get that I have
done the mapping. I still get a "Not Found" exeption. If I check the
mapping from within the code it exists.
Here is a part of the code I use.

Dim FileName as string = "Test.txt"
Dim UNC as string = Any UNC path
Dim Mapped as string

Mapped = 'Create a mapping to the UNC path

Console.Write(system.IO.Directory.Exists(Mapped))

Dim objFile As New ManagementObject(New
ManagementPath("Win32_LogicalfileSecuritySetting=' " + _
Mapped.Replace("\", "\\") + "'"))
Console.Write(objFile.GetText(TextFormat.Mof)) 'Here we get a "Not
Found" exieption

Thanks
Johan

Nov 20 '05 #2

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

Similar topics

1
by: Serge | last post by:
Hi, i would map a network drive from a share on another server. it works fine with the net use command under user login but it do not work from an asp script or dll. is this that i have to...
4
by: Dhruv | last post by:
Hi, I was wondering is there a way to map a network drive a on persons machine with a online gui interface? Is there a way user 1 can map drives on THEIR computer using an online interface? ...
0
by: Jim | last post by:
Hello, I have an intranet that I would like to set up a web page on. This web page would contain hyperlinks that when clicked would automatically map a network drive to the computer. Does...
0
by: Rob | last post by:
Hi, Does anyone know of a good reference for mapping a network drive programmatically using VB.Net? Is it best to use API calls or is there a better way to do it? Thanks Rob
2
by: Tomas Vera | last post by:
Hello All, I have a web application that is required to copy a file from the WebServer to a remote web server (staging server to production server). I've created an application that maps the...
0
by: fndjoum | last post by:
When using Visual Studio 2005, I was able to read the text file if it's in my local c:\ drive ifstream myfile; myfile.open("C:\\test.txt"); --------------> this works on local drive ...
13
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I am actually trying to get the UNC path of the main module of a process running from a mapped drive, and I am trying to do this from a service. The ProcessModule class only provides the full path...
10
by: =?Utf-8?B?Z3JlYXRiYXJyaWVyODY=?= | last post by:
Sorry about that previous one. I pressed enter too early. How does one go about mapping a network drive in C#. i know you use MapNetworkDrive in scripting languages, but i'm not sure how to do it...
0
by: Daffydd | last post by:
Hi all, This one's driving me up a wall! We have a small office network, Windows SBS 2003, nothing fancy - recently upgraded from an old Compaq running Novell. Back in the day we used the "F"...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
0
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.