I'm not sure why on earth you would ask that question here, but I suppose I'm only encouraging you by answering.

Basically, the file system remote stuff doesn't let you easily supply alternate credentials. You need to impersonate the alternate user and perform the operation that. It isn't like with ADSI/S.DS where you can just supply alternate credentials and it just works.

There is a nice sample in the .NET SDK docs for WindowsImpersonationContext that shows how to call the LogonUser API to obtain a logon token with a user's credentials and then impersonate that token to perform an operation.

I hope that helps.

Joe K.

----- Original Message ----- From: Steven Wood
To: ActiveDir@mail.activedir.org
Sent: Friday, November 17, 2006 11:03 AM
Subject: [ActiveDir] VB2005 copy dir using AD credentials


Hi All,

I'm writing a VB2005 program, the problem I have is that the program will copy a directory to a network location but I need to supply AD credentials as the user running the program doesn't have permission to the network location. Does anyone have any ideas of how I can do this or point me in the direction of a blog/site with examples etc?

Many thanks
Steven

My.Computer.FileSystem.CopyDirectory("C:\ SpeedyScan\ScanningTemp\", copyPath)

List info   : http://www.activedir.org/List.aspx
List FAQ    : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir@mail.activedir.org/

Reply via email to