Sharing a CD drive in

I am trying to write a server application that will run on a PC and when requested from a client will share the CDROM drive to a client for a short period of time.  My server program will listens on a port using winsock and then when I get a request I want to programatially create a share and send the share name back to the Client to use.  Then when the client is done, I want to delete it.  I am stuck on programatically creating the share on the server and then on the client creatinng a mapped drive to it.  Anyone have any samples in VB.NEt on how do this?  I have everything working but Creating the share on the server.  and then just mapping it in the client.  the client program does have the ip address of the server for mapping.
Who is Participating?
i guess so...
1) try to execute program(your_program.exe) with administrator rights
2) Or you can try this way. but it will show command prompt while executing the command
Dim theSecureString As New Security.SecureString()

        Process.Start("net", " share MyDvdDrive=L:\", "Administrator", theSecureString, "")
About SecureString =>
Represents text that should be kept confidential. The text is encrypted for privacy when being used, and deleted from computer memory when no longer needed.

1) programatially create a share and send the share name back to the Client to use.
well you can use shell commands like net share to create and delete share drive like ....
To create share =>   Shell("net share MyDvdDrive=L:\", AppWinStyle.Hide, True, 50)
To delete share =>   Shell("net share L:\  /delete", AppWinStyle.Hide, True, 50)
here you can create random share name or use any fixed one instead MyDvdDrive.
or just try => net share /? in dos
or you can write function like

2)Mapping Drive
 Same for here also. you can use shell commands then open mapped drive programmatically.
To map drive => Shell("net use Z \\**.**.**.**\sharename /user:username pass",AppWinStyle.Hide, True, 50)
To delete mapped drive => Shell("net use Z: /delete",AppWinStyle.Hide, True, 50)

here z is the drive letter to connect. you can use whatever you want(except used once).
help =>  net use /?

Try it out. may be this can help
edfrazierAuthor Commented:
Thanks, This seems simple.  I will give it a try and let you know
edfrazierAuthor Commented:
It seems easy but it does not seem to work with Vista.  i guess this is becuase of the tight security Vista uses?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.