Map network drive for user using VB/ASP.NET

B

Brian Nicholson

Hello,

I'm trying to create an admin page that can run miscellaneous scripts for
our IT department. Currently, I'm trying to create a script that can map a
network drive for a user (e.g. a form where I can input \\path\folder, drive
letter, and domain\user). Is this possible? If so, can someone point me in
the right direction?

Thank you,
Brian Nicholson
 
J

Junior

If you get to Technet as well as elsewhere you will learn about PowerShell
which has become the optimal way to use the framework for administrative
tasks.
 
B

Brian Nicholson

Mark Rae said:
Not natively through ASP.NET, for fairly obvious security reasons - remember
that web app cannot have any direct interaction with client machines due to
the disconnected architecture of the web...

To achieve this you'd need to look at something like a custom ActiveX
control - can't recommend it...
Forgive my ignorance as I am very new to ASP.NET, but what would be the
security problems of a web app that uses IIS with Integrated Windows
Authentication? Also, I thought that mapping network drives was a
user-specific task (not machine-specific) -- if that even makes a difference.

Thank you for your help.
 
J

Junior

So you are the kind of guy who makes excuses rather than finding an
acceptable way to get things done?


Mark Rae said:
[top-posting corrected]
If you get to Technet as well as elsewhere you will learn about
PowerShell which has become the optimal way to use the framework for
administrative tasks.

PowerShell won't allow a web app map a network drive via a client browser
without using ActiveX and seriously ramping down the security level - at
that point, you may as well not bother...
 
B

Brian Nicholson

Mark Rae said:
It's not the web app per se - it's the browser. All modern browsers are
specifically designed to prevent *any* direct interaction with the user's
hardware other than for things like cookies etc. The fact that you're using
Windows authentication in an intranet environment is of no concern to the
browser, which is the same browser that you use to go out onto the public
Internet and do your on-line banking etc - the browser itself doesn't
understand the difference. All it knows how to do is send an HttpRequest to
a webserver and then process and display the HttpResponse which the
webserver streams back to it - makes no difference whether that webserver is
in your comms room or half-way round the world.

To give you a rather extreme example, imagine a web app which could stream
down an instruction to the client browser to run the equivalent of "format
c:" on the client machine...

Mapping a network drive involves direct interaction with the client machine
as far as the browser is concerned, so it's not permitted.

I kind of understand what you're saying, but I didn't think I was using the
browser itself as a means to perform the task -- I don't want the drive to be
mapped on the client computer that's actually going to the web app. I was
considering something like an admin page where the admin could enter certain
things like a network path, username, etc., and the app would use these
values in a VB script which could then perform the function (as if we weren't
using a web app to begin with), e.g. using something similar to VBScript's
MapNetworkDrive.

I apologize if you knew this already and I misunderstood your post.
 
J

Junior

PowerShell


Brian Nicholson said:
I kind of understand what you're saying, but I didn't think I was using
the
browser itself as a means to perform the task -- I don't want the drive to
be
mapped on the client computer that's actually going to the web app. I was
considering something like an admin page where the admin could enter
certain
things like a network path, username, etc., and the app would use these
values in a VB script which could then perform the function (as if we
weren't
using a web app to begin with), e.g. using something similar to VBScript's
MapNetworkDrive.

I apologize if you knew this already and I misunderstood your post.
 
B

Brian Nicholson

Junior said:
PowerShell

I have no experience at all with PowerShell (I have very little experience
with ASP.NET as it is), but if it's able to do this through ASP.NET then I'm
interested. Do you happen to know how it can be done? After a quick search,
I found articles mentioning the same MapNetworkDrive that exists in VBScript
-- the problem with this method is that it requires the password of the user
I'm mapping a drive to.
 
B

Brian Nicholson

Mark Rae said:
Please clarify on which machine you intend to map a network drive: the
client machine, the web server or a different machine altogether...

From my understanding of mapped network drives, they're done per user; the
drives aren't mapped on the actual machine. If by which machine I intend to
use to map it you meant the machine that will do the actual mapping, I
suppose the web server will do that. Basically, I want to be able to use
administrative rights over some web application that allows me to map a
network folder to a drive for a specified user.
 
B

bruce barker

it sounds like you are trying to update the users profile and maybe the login
script. this can be done if the web site appdomin runs as a network admin or
you use kerberos and an admin logs on. see the wmi library for the routines.
you will need to switch to a nt admin forum to learn how to use wmi.

-- bruce (sqlwork.com)
 
B

bruce barker

while powershell is a handy for creating admin scripts, spawing a powershell
script to perform admin operations from a website is a pretty sketchy
programming practice, sign of a true hack.

if asp.net ever supports powershell as a language, then this might make
sense, but currently perl (which asp.net supports) would be a better choice
if you wanted to use an admin scripting language.

-- bruce (sqlwork.com)
 
B

Brian Nicholson

Mark Rae said:
I wonder if we are we getting bogged down in nomenclature here...?

The term "mapped network drive" means, to me at least, that there is a share
(usually a folder on a remote fileserver) something like
\\fileserver\sharedfiles\Mark which I want to access as if it were a local
drive on my machine. So I map a drive letter to it, e.g. P:\, which then
appears in Windows Explorer...

This means that I can then refer to files stored on the remote share using
the syntax e.g. P:\MyDocument.docx rather than having to type
\\fileserver\sharedfiles\Mark\MyDocument.docx

Is that what you mean?

If so, then the mapped drive is on my machine...

All right, I apologize -- the example I was thinking of was NET USE, which
takes a domain\username as a parameter rather than the computer name, but I
guess it finds the computer that the specified user is on and makes the
changes there. In any case, in response to your question, I was referring to
a different computer altogether.
 
B

Brian Nicholson

Mark Rae said:
Hmm - I don't believe this is correct.

As I understand it, the domain\username parameter is used to specify the
credentials under which the NET USE command will run - the network drive
will still be mapped on the machine on which the NET USE command is being
issued...

E.g. an "ordinary" domain user might not have sufficient privileges to map a
network drive due to policies etc, but a domain admin can pop a command
prompt and issue the NET USE command by supplying his domain admin
credentials...

Ah okay...that would make more sense then.
 
B

Brian Nicholson

bruce barker said:
it sounds like you are trying to update the users profile and maybe the login
script. this can be done if the web site appdomin runs as a network admin or
you use kerberos and an admin logs on. see the wmi library for the routines.
you will need to switch to a nt admin forum to learn how to use wmi.

-- bruce (sqlwork.com)

Thanks for the tips...I'll see what I can do with WMI.
 
B

Brian Nicholson

All right -- I'll admit that I've never used newsgroups previously to post my
questions and I am unaware of the conventions. I apologize for the
inconvenience.
 
J

Junior

PowerShell is Microsoft's newest approach to system administration and is
meant to supercede the cmd shell and VBScript both of which remain present
but are lame in comparison. PowerShell requires .NET 2.0 as it uses the
classes from the framework.

To others in this topic I do not say that PowerShell commands (cmdlet) run
through the browser but IMO should be learned by anybody who has system
administration responsibilities. Visual tools to use PowerShell are
available but need to mature.

Technet Magazine and http://technet.com is where a lot can be learned and a
quick look can be gained using the site filter

//search
powershell site:technet.com
 
K

Karl Mitschke

Hello Junior,

I issue powershell commands all day long through aspx pages for Exchange
Recipient tasks.

Well, OK, our service desk does, using pages I created.

Depending on what the OP really wants, he could use powershell to modify
a user object in AD, or vbscript which he might be more familier with.
 
K

Kirk Barnett

I am looking to map a network drive on the CLIENT machine. Our plan is to have the user connect to VPN, then go to a web page, click a button & map network drives (i.e. p: \\servername\public). So, ultimately, the CLIENT machine has the drive showing up under 'My Computer.' Does PowerShell allow this to occur? thansk.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top