I am trying to figure out how to accomplish the following task:
- Create a network share on a remote
computer using .NET - The target computer is
on the same network. - The target computer’s
admin username and password are
known.
Your thoughts? How would you go about to accomplish this?
The best and easiest method to do Windows Administrative tasks from code is through WMI. Almost anything can be done on a Windows machine, local or remote, through WMI.
In order to administer a Windows shared folder you will need to interact with the
Win32_ShareWMI class.Sample on how to use WMI to create a shared folder:
You will need to add a reference to the
System.Managementassembly in order to access the WMI classes. You’ll also need access to the remote machine of course.Check out the WMI Reference for more details. Specifically check out the Win32_Share Class reference on what all the parameters and return codes mean.