0

I am trying to build a windows application that will automate a regular routine steps that I have to do for taking a backup.

The flow goes like this...

1.open a folder
2.run an exe there
3.open jumpbox server at which point we have to enter a username and password
4.create a folder
5.then open a network folder using the ip such as //ip.ip.ip.ip/folder (i do this from run)
6.copy a file from this folder to the created folder and rename it

and some other stuff like this.

I handle some of the stuff like open a folder, creating a folder and stuff like that but how to connect to a network folder and give the username and password to it when its asking from within the application.

Jackson Pope
  • 14,520
  • 6
  • 56
  • 80
swordfish
  • 4,899
  • 5
  • 33
  • 61
  • Does it have to be in C# or VB.NET? This would be a great job for Powershell (which can use CLR objects if you wish), or even a regular cmd.exe batch script. – Hut8 Apr 28 '11 at 08:07

2 Answers2

1

I see you run external commands, so you could use "NET USE...".
Run NET HELP USE to see syntax...

Marco
  • 56,740
  • 14
  • 129
  • 152
1

All these things that can be controlled with a .Net application.

You can use System.Diagnotics.Process to launch other executables in a process.

Both System.IO.Directory and System.IO.DirectoryInfo can be used to do all sorts of folder manipulation.

As for connecting to a network drive which, I think is the actual question, you'll have to excuse my ignorance on jumpboxes. If a user on your domain has access you will need to impersonate that user as suggested here, or if it is a seperate domain, as I suspect is the case, you can use the API as suggested here.

Community
  • 1
  • 1
Jodrell
  • 34,946
  • 5
  • 87
  • 124
  • Thank you, as i mentioned in the mail i did know about both diagnostics and directory, but this wnet is really what i need and didnt know so far about. – swordfish Apr 29 '11 at 01:46