Mapping of network drive does not get recognized by WMI?

J

Johan

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
 
O

One Handed Man \( OHM#\)

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top