Mapping of network drive does not get recognized by WMI?

  • Thread starter Thread starter Johan
  • Start date Start date
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
 
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
 
Back
Top