We have some tests that need to test various methods of acquiring files from other computers. This led to a challenge of writing C# code to automate the process of creating HTTP and FTP virtual directories in IIS, sharing folders, mapping network drives, and adjust NTFS permissions.
With a little searching around the net I was able to get it all going. I won't repost all the content, but here are links to pages that should get you going:
- Create virtual directories in IIS
- Share folders (start a new Process with "net share")
- Map network drives (same as sharing folders but with the "net use" command)
- Add and remove NTFS permissions
One more random piece of advice from my work today, I needed to use System.IO.Packaging (part of .NET 3.0) which is contained in windowsbase.dll. For some reason, that reference doesn't show up in the "Add Reference" dialog in Visual Studio. It's in the GAC, but not in that list. The dll can be found at C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll so I added a reference straight to that file.