Creating a Physical Directory Using DirectoryServices

M

Mick Walker

Hi all,

I am wondering is it possible to create a physical Directory such as
"C:\Test" using the DirectoryServices namespace.

If so, does anyone have any resources on how to do it? I should also
mention, I am required to create the physical directory on any machine
within the current AD domain.

Kind Regards
 
M

Mark Rae [MVP]

I am wondering is it possible to create a physical Directory such as
"C:\Test" using the DirectoryServices namespace.

If so, does anyone have any resources on how to do it? I should also
mention, I am required to create the physical directory on any machine
within the current AD domain.

Are you perhaps getting confused between directories...? The "directory" in
ActiveDirectory is not the same as a "directory" (a.k.a. "folder") on a file
system...

In order to create a file system directory in .NET you use the
CreateDirectory method in the System.IO namespace:
http://msdn2.microsoft.com/en-us/library/54a0at6s(vs.80).aspx

However, since you've posted in an ASP.NET newsgroup, note that you will not
be able to make an ASP.NET app create folders on browser machines natively,
for security reasons...
 
M

Mick Walker

Mark said:
Are you perhaps getting confused between directories...? The "directory"
in ActiveDirectory is not the same as a "directory" (a.k.a. "folder") on
a file system...

In order to create a file system directory in .NET you use the
CreateDirectory method in the System.IO namespace:
http://msdn2.microsoft.com/en-us/library/54a0at6s(vs.80).aspx

However, since you've posted in an ASP.NET newsgroup, note that you will
not be able to make an ASP.NET app create folders on browser machines
natively, for security reasons...
No I am not getting confused I know what System.IO does, there is simply
a clash with nameing conventions.

Let me rephrase:

I wish to be able create a folder on any computer within the current
Active Directory Domain.

I am controling IIS using the Microsoft.Web.Administration.

We are using windows 2008 build 6001

I can create the nessesary items within IIS, websites, Virtual Folders,
set permissions etc. All I need now is a way to create the physical path
to correspond to the properties I am setting.

ASP.Net is running with suitable permissions to impersonate a user that
has permission to create folders on the target machines (Web Servers).

If I cant do it via DirectoryServices, I think I shall have to go down
the path (No not a file system path :p) of having a WebService running
on each of the Web Server in the AD domain, that will be able to create
the file structures needed, However I would like to use Directory
Services to avoid the potential security risks of the latter method.
 
M

Mark Rae [MVP]

I wish to be able create a folder on any computer within the current
Active Directory Domain.

I am controling IIS using the Microsoft.Web.Administration.

We are using windows 2008 build 6001

I can create the nessesary items within IIS, websites, Virtual Folders,
set permissions etc. All I need now is a way to create the physical path
to correspond to the properties I am setting.

ASP.Net is running with suitable permissions to impersonate a user that
has permission to create folders on the target machines (Web Servers).

Creating folders server-side should be no problem so long as ASP.NET can see
the drives on which you want to create the folders...
If I cant do it via DirectoryServices, I think I shall have to go down the
path (No not a file system path :p) of having a WebService running on
each of the Web Server in the AD domain, that will be able to create the
file structures needed, However I would like to use Directory Services to
avoid the potential security risks of the latter method.

There simply is no way to persuade DirectoryServices to create folders -
it's just not what it's for...

What errors do you get if you do something like:

DirectoryInfo di = Directory.CreateDirectory("\\ServerName\\c$\\Test");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top