>I need to test if a directory on a server is mapped to the local client workstation and if it is not, I want to create the mapping.
>
>For example does my S: drive on the client point to \\MANTIS\public\IMPORT\ on the server.
>
>If not, create an S:drive and point to the above server directory.
>
The UNC assigned to a mapped drive can be retrieved using the Win32 API; I have sample code in the FAQ entry #522
How do I determine the UNC for a mapped drive?Drive mapping can be done using WNetAddConnection3; there's a sample in my NETSOURCE class, downloadable as file #
9502 NETRESOURCE structure class - this relies on my CLSHEAP class, also available in the files section.
If the drive mapping is incoprrect, you need to use WNetCancelConnection2() to release the drive mapping.
The Windows Script Host's Wscript.Network automation object can accomplish these tasks as well, and offer added functionality as well. I'd seriously consider usign the WSH's automation objects rather than the API; you can download detailed inforamtion on the WSH from msdn.micrsooft.com/scripting