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 20 7058
On Jun 29, 11:42*pm, Brian Nicholson
<BrianNichol...@discussions.microsoft.comwrote:
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
Hi,
If you're meaning to transfer files across computers that are on the
same network, you can simply use it by calling mapped computer's name
with UNC path or network IP address:
My.Computer.Network.DownloadFile("\\MAPPED_PC\fold er\file.exe",c:
\file.exe")
Additionaly, you need to set networkCredentials parameter if your
drives require network authentecation.
Hope this helps,
Onur Güzel
On Jun 30, 1:09*am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Jun 29, 11:42*pm, Brian Nicholson
<BrianNichol...@discussions.microsoft.comwrote:
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 mapa
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
Hi,
If you're meaning to transfer files across computers that are on the
same network, you can simply use it by calling mapped computer's name
with UNC path or network IP address:
My.Computer.Network.DownloadFile("\\MAPPED_PC\fold er\file.exe",c:
\file.exe")
Additionaly, you need to set networkCredentials parameter if your
drives require network authentecation.
Hope this helps,
Onur Güzel
However you can do it also with System.IO.File.Copy using UNC
and, correcting my previous syntax as:
My.Computer.Network.DownloadFile("\\MAPPEDPC\\file .exe","c:\file.exe")
or one of System.IO.File's methods to work with your mapped drive on
domain / workgroups using proper credentials.
HTH,
Onur G.
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:29**********************************@microsof t.com...
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?
As someone else said, you might not find a VB example, and as a good .Net
programmer, you need to know C# and VB. It's not that hard to translate.
There is no reason that you can't use the class for an ASP.Net solution.
There is also no reason you couldn't just take the class talked about as is,
compile as a C# dll, and set reference to the DLL and use it in your VB
project. http://www.codeproject.com/KB/system/mapnetdrive.aspx
"Mr. Arnold" wrote:
>
As someone else said, you might not find a VB example, and as a good .Net
programmer, you need to know C# and VB. It's not that hard to translate.
There is no reason that you can't use the class for an ASP.Net solution.
There is also no reason you couldn't just take the class talked about as is,
compile as a C# dll, and set reference to the DLL and use it in your VB
project.
http://www.codeproject.com/KB/system/mapnetdrive.aspx
Thank you for the response. I have no problems using C# code; I just asked
that initially because it's what I'm most familiar with. I've come across
that class before, but the problem is that it requires the password of the
user I'm mapping a network drive for. I was hoping there was some way I
could use IIS Windows Authentication or something similar to do this with an
account that has administrative rights, so I wouldn't be required to know the
user's password.
"Brian Nicholson" wrote:
"Mr. Arnold" wrote:
As someone else said, you might not find a VB example, and as a good .Net
programmer, you need to know C# and VB. It's not that hard to translate.
There is no reason that you can't use the class for an ASP.Net solution.
There is also no reason you couldn't just take the class talked about as is,
compile as a C# dll, and set reference to the DLL and use it in your VB
project. http://www.codeproject.com/KB/system/mapnetdrive.aspx
Thank you for the response. I have no problems using C# code; I just asked
that initially because it's what I'm most familiar with. I've come across
that class before, but the problem is that it requires the password of the
user I'm mapping a network drive for. I was hoping there was some way I
could use IIS Windows Authentication or something similar to do this with an
account that has administrative rights, so I wouldn't be required to know the
user's password.
I posted this same question in the ASP.NET newsgroup -- it appears what I
would like to do isn't feasible without resorting to ActiveX. Thanks for the
replies.
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:2F**********************************@microsof t.com...
"Brian Nicholson" wrote:
>"Mr. Arnold" wrote:
>
As someone else said, you might not find a VB example, and as a good
.Net
programmer, you need to know C# and VB. It's not that hard to
translate.
There is no reason that you can't use the class for an ASP.Net
solution.
There is also no reason you couldn't just take the class talked about
as is,
compile as a C# dll, and set reference to the DLL and use it in your VB
project.
http://www.codeproject.com/KB/system/mapnetdrive.aspx
Thank you for the response. I have no problems using C# code; I just asked that initially because it's what I'm most familiar with. I've come across that class before, but the problem is that it requires the password of the user I'm mapping a network drive for. I was hoping there was some way I could use IIS Windows Authentication or something similar to do this with an account that has administrative rights, so I wouldn't be required to know the user's password.
I posted this same question in the ASP.NET newsgroup -- it appears what I
would like to do isn't feasible without resorting to ActiveX. Thanks for
the
replies.
I kind of doubt that.
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:24**********************************@microsof t.com...
"Mr. Arnold" wrote:
>> As someone else said, you might not find a VB example, and as a good .Net programmer, you need to know C# and VB. It's not that hard to translate. There is no reason that you can't use the class for an ASP.Net solution.
There is also no reason you couldn't just take the class talked about as is, compile as a C# dll, and set reference to the DLL and use it in your VB project.
http://www.codeproject.com/KB/system/mapnetdrive.aspx
Thank you for the response. I have no problems using C# code; I just
asked
that initially because it's what I'm most familiar with. I've come across
that class before, but the problem is that it requires the password of the
user I'm mapping a network drive for. I was hoping there was some way I
could use IIS Windows Authentication or something similar to do this with
an
account that has administrative rights, so I wouldn't be required to know
the
user's password.
I don't see why you couldn't use a generic user-id and psw that had admin
rights, but of course this application should never face the Internet.
"Mr. Arnold" wrote:
>
I don't see why you couldn't use a generic user-id and psw that had admin
rights, but of course this application should never face the Internet.
That's exactly what I would like to do, but I don't see how that could be
done with this class (or other methods I've found). If I were to supply an
admin username/password, it would map the drive to that admin user -- I want
to perform this task under an admin account, but the drive should actually be
mapped for another user.
As for doubting the impossibility of doing this without ActiveX, you might
be right -- I think the Microsoft MVP may have misunderstood what I was
trying to do.
"Brian Nicholson" wrote:
>
That's exactly what I would like to do, but I don't see how that could be
done with this class (or other methods I've found). If I were to supply an
admin username/password, it would map the drive to that admin user -- I want
to perform this task under an admin account, but the drive should actually be
mapped for another user.
As for doubting the impossibility of doing this without ActiveX, you might
be right -- I think the Microsoft MVP may have misunderstood what I was
trying to do.
Scratch that -- I originally thought that the username and password were for
the destination of the drive mapping, but it makes more sense that the
username and password is to simply supply credentials for mapping the drive
on the local computer. I guess my question then is how do I get this script
to execute on a specified computer other than the web server?
IMO your best would be to explain why you are trying to map a drive (i.e. I
mean the overall goal not the way you plan to this for now).
Do you try to map a drive server side ? I would avoid doing such a thing and
would use an UNC drive ? (do you REALLY need a mapped drive ???)
Do you try to map a drive client side ? It looks like it would be best
suitable to do that from the login script rather than using a web
application. If this is to be able to run scripts from a network share they
could be best placed on the NETLOGON share etc....
Knowing exactly what is the overall goal could raise better suggestions...
--
Patrice
"Brian Nicholson" <Br************@discussions.microsoft.coma écrit dans le
message de groupe de discussion : 4B**********************************@microsoft.com...
"Mr. Arnold" wrote:
>> I don't see why you couldn't use a generic user-id and psw that had admin rights, but of course this application should never face the Internet.
That's exactly what I would like to do, but I don't see how that could be
done with this class (or other methods I've found). If I were to supply
an
admin username/password, it would map the drive to that admin user -- I
want
to perform this task under an admin account, but the drive should actually
be
mapped for another user.
As for doubting the impossibility of doing this without ActiveX, you might
be right -- I think the Microsoft MVP may have misunderstood what I was
trying to do.
You would have to send a client side script inside your web page. This
script would use the WScript.Network object to map the drive. You'll need
also to alter security settings - possibly done by your admin at an
entreprise level - to be able to do that (for example adding your intranet
site to the trusted sites).
Not sure why you need to do that but my personal preference would be to have
the admin team creating a mapping strategy and have the network drives
mapped automatically using the logon script (possibly depending about the
group in which the user is). Try for example http://www.bluestream.org/Windows/LoginScripting.htm
As said earlier you may want to elaborate about your final goal...
--
Patrice
"Brian Nicholson" <Br************@discussions.microsoft.coma écrit dans le
message de groupe de discussion : 5F**********************************@microsoft.com...
"Brian Nicholson" wrote:
>> That's exactly what I would like to do, but I don't see how that could be done with this class (or other methods I've found). If I were to supply an admin username/password, it would map the drive to that admin user -- I want to perform this task under an admin account, but the drive should actually be mapped for another user.
As for doubting the impossibility of doing this without ActiveX, you might be right -- I think the Microsoft MVP may have misunderstood what I was trying to do.
Scratch that -- I originally thought that the username and password were
for
the destination of the drive mapping, but it makes more sense that the
username and password is to simply supply credentials for mapping the
drive
on the local computer. I guess my question then is how do I get this
script
to execute on a specified computer other than the web server?
Good question -- as far as I know, it's a matter of convenience. Users
constantly access the same network folders, and it's a pain to have to browse
to the folder each time something needs to be saved/accessed. Users call in
requesting to have a certain directory mapped as a drive, so it would be
convenient to have a web app that can do this for us.
"Patrice" wrote:
IMO your best would be to explain why you are trying to map a drive (i.e. I
mean the overall goal not the way you plan to this for now).
Do you try to map a drive server side ? I would avoid doing such a thing and
would use an UNC drive ? (do you REALLY need a mapped drive ???)
Do you try to map a drive client side ? It looks like it would be best
suitable to do that from the login script rather than using a web
application. If this is to be able to run scripts from a network share they
could be best placed on the NETLOGON share etc....
Knowing exactly what is the overall goal could raise better suggestions...
--
Patrice
"Brian Nicholson" <Br************@discussions.microsoft.coma crit dans le
message de groupe de discussion : 4B**********************************@microsoft.com...
"Mr. Arnold" wrote:
>
I don't see why you couldn't use a generic user-id and psw that had admin
rights, but of course this application should never face the Internet.
That's exactly what I would like to do, but I don't see how that could be
done with this class (or other methods I've found). If I were to supply
an
admin username/password, it would map the drive to that admin user -- I
want
to perform this task under an admin account, but the drive should actually
be
mapped for another user.
As for doubting the impossibility of doing this without ActiveX, you might
be right -- I think the Microsoft MVP may have misunderstood what I was
trying to do.
On Jun 30, 12:21*pm, Brian Nicholson
<BrianNichol...@discussions.microsoft.comwrote:
"Brian Nicholson" wrote:
That's exactly what I would like to do, but I don't see how that could be
done with this class (or other methods I've found). *If I were to supply an
admin username/password, it would map the drive to that admin user -- I want
to perform this task under an admin account, but the drive should actually be
mapped for another user.
As for doubting the impossibility of doing this without ActiveX, you might
be right -- I think the Microsoft MVP may have misunderstood what I was
trying to do.
Scratch that -- I originally thought that the username and password were for
the destination of the drive mapping, but it makes more sense that the
username and password is to simply supply credentials for mapping the drive
on the local computer. *I guess my question then is how do I get this script
to execute on a specified computer other than the web server?
To me, the easiest solutions would be to write a small Window's app
that maps the network drive and then publish that application to your
website. Then, using ClickOnce deployment, all a user would have to do
is click the link, select 'Run', and then the window's app would run
and map the drive. The nice thing is that since it's a Window's app,
you can easily run impersonation and run the "map drive" commands
under an admin account, invisible to the user.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
"rowe_newsgroups" wrote:
>
To me, the easiest solutions would be to write a small Window's app
that maps the network drive and then publish that application to your
website. Then, using ClickOnce deployment, all a user would have to do
is click the link, select 'Run', and then the window's app would run
and map the drive. The nice thing is that since it's a Window's app,
you can easily run impersonation and run the "map drive" commands
under an admin account, invisible to the user.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
That sounds pretty similar to what I'd like to do, but the part I'm stuck on
is actually creating the app that maps the drive. So far, I've been
unsuccessful finding any kind of method or class that can map a drive
*remotely*...if such a thing even exists.
On Jun 30, 1:35*pm, Brian Nicholson
<BrianNichol...@discussions.microsoft.comwrote:
"rowe_newsgroups" wrote:
To me, the easiest solutions would be to write a small Window's app
that maps the network drive and then publish that application to your
website. Then, using ClickOnce deployment, all a user would have to do
is click the link, select 'Run', and then the window's app would run
and map the drive. The nice thing is that since it's a Window's app,
you can easily run impersonation and run the "map drive" commands
under an admin account, invisible to the user.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
That sounds pretty similar to what I'd like to do, but the part I'm stuck on
is actually creating the app that maps the drive. *So far, I've been
unsuccessful finding any kind of method or class that can map a drive
*remotely*...if such a thing even exists.
This wouldn't be remotely, it would be running from the user's
physical computer. I'm starting to think I misunderstood what you are
looking for.
Are you trying to map a user from an admin's machine? If so I'd say
scrap the .NET and go for a simple login script that would be ran when
the user logs into his PC. I'm not an admin by any means, but I know
that's how the network admin at my old job mapped user drives.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
"rowe_newsgroups" wrote:
>
This wouldn't be remotely, it would be running from the user's
physical computer. I'm starting to think I misunderstood what you are
looking for.
Are you trying to map a user from an admin's machine? If so I'd say
scrap the .NET and go for a simple login script that would be ran when
the user logs into his PC. I'm not an admin by any means, but I know
that's how the network admin at my old job mapped user drives.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
Yeah, that's where it all seems to be leading. I'm pretty sure that's what
the IT dept. does now (I'm just a summer intern), but they're trying to get
me to make a page that makes the process a little simpler. I've never used
WMI (or heard of it, as a matter of fact, before today), but it sounds like
I'll have to use it to update profiles of users to do this.
Users call in
requesting to have a certain directory mapped as a drive, so it would be
convenient to have a web app that can do this for us.
And the user would just choose from predefined mapping in this page ? Don't
you have a logon script in place ? IMO it would be much better to do that
from a logon script (using kixtart, you can test in which group the user is
to map the appropriate drives). If not already done I would recommend also
having always the same letter mapped to the same location.
Your logon script (example taken from the http://www.bluestream.org/Windows/LoginScripting.htm link I posted ealier)
could look like :
IF INGROUP("Accounting")
USE T: "\\SERVER1\TAXSOFT"
ENDIF
etc...
IMO you should direct your admins to an admin group so that they can see how
it is usually done using a login script. It may require a bit of work to put
that in place especially if all users have used random letters for a given
location accross your company, but then it will basically done
automatically once the rules are defined making this much easier to handle
for both admins and users.
For example when you put a new location or if you migrate content from one
server to another your admins will have just to update the logon script and
this is done for all users concerned with these changes the next time they
log. You won't have to tell each targeted user to go to a web page to hand
select the new mapping(s). Etc...
--
Patrice
"Patrice" wrote:
>
And the user would just choose from predefined mapping in this page ? Don't
you have a logon script in place ? IMO it would be much better to do that
from a logon script (using kixtart, you can test in which group the user is
to map the appropriate drives). If not already done I would recommend also
having always the same letter mapped to the same location.
Your logon script (example taken from the http://www.bluestream.org/Windows/LoginScripting.htm link I posted ealier)
could look like :
IF INGROUP("Accounting")
USE T: "\\SERVER1\TAXSOFT"
ENDIF
etc...
IMO you should direct your admins to an admin group so that they can see how
it is usually done using a login script. It may require a bit of work to put
that in place especially if all users have used random letters for a given
location accross your company, but then it will basically done
automatically once the rules are defined making this much easier to handle
for both admins and users.
For example when you put a new location or if you migrate content from one
server to another your admins will have just to update the logon script and
this is done for all users concerned with these changes the next time they
log. You won't have to tell each targeted user to go to a web page to hand
select the new mapping(s). Etc...
--
Patrice
Well not the users themselves mapping the drives -- the IT department would
still do that. I'm basically making an IT admin page where the most commonly
used administrative functions are grouped together so they don't have to
branch out all over the place to perform various tasks.
It sounds like it will have to be done from a logon script, like you said;
I'm still hoping to use ASP.NET if possible as a means to populate the
script, then perhaps use WMI to make the changes.
On Jun 30, 3:11*pm, Brian Nicholson
<BrianNichol...@discussions.microsoft.comwrote:
"Patrice" wrote:
And the user would just choose from predefined mapping in this page ? Don't
you have a logon script in place ? IMO it would be much better to do that
from a logon script (using kixtart, you can test in which group the user is
to map the appropriate drives). If not already done I would recommend also
having always the same letter mapped to the same location.
Your logon script (example taken from the http://www.bluestream.org/Windows/Lo...ipting.htmlink I posted ealier)
could look like :
IF INGROUP("Accounting")
* * USE T: "\\SERVER1\TAXSOFT"
ENDIF
etc...
IMO you should direct your admins to an admin group so that they can see how
it is usually done using a login script. It may require a bit of work to put
that in place especially if all users have used random letters for a given
location accross your company, *but then it will basically done
automatically once the rules are defined making this much easier to handle
for both admins and users.
For example when you put a new location or if you migrate content from one
server to another your admins will have just to update the logon scriptand
this is done for all users concerned with these changes the next time they
log. You won't have to tell each targeted user to go to a web page to hand
select the new mapping(s). Etc...
--
Patrice
Well not the users themselves mapping the drives -- the IT department would
still do that. *I'm basically making an IT admin page where the most commonly
used administrative functions are grouped together so they don't have to
branch out all over the place to perform various tasks.
It sounds like it will have to be done from a logon script, like you said;
I'm still hoping to use ASP.NET if possible as a means to populate the
script, then perhaps use WMI to make the changes.
I'd say the best you can hope for is to create an ASP.NET page that
takes information from the user and then generates the script that
needs to be ran from a login script. Simplest way would be to just
output the script into a textbox on the page so that the user could
tweak the script manually if need be.
Also, if the login script that is to be ran has any logic behind it
(say every morning the script to run is pulled from a network file
path) then your ASP.NET page could modify that file so that the next
time the new file is copied over for users to run it would contain
your updated version. I don't really know if this would work, like I
said I'm not a net admin so I'm not sure if this option is even
viable.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
Well not the users themselves mapping the drives -- the IT department
would
still do that. I'm basically making an IT admin page where the most
commonly
used administrative functions are grouped together so they don't have to
branch out all over the place to perform various tasks.
It sounds like it will have to be done from a logon script, like you said;
I'm still hoping to use ASP.NET if possible as a means to populate the
script, then perhaps use WMI to make the changes.
Ah I didn't understood it was for admins but I don't really catch the
benefit you"ll get to edit a text file through a web page rather than using
notepad... It could be perhaps just a link (anchor whith a file://whatever
href) to the script file so that notepad is triggered. I'm not an admin but
AFAIK this is just a plain good old text file that is replicated all over
your domain as soon as editing is done so you have nothing sepcial to do to
make this file available to users...
Else you can do that from the admin console that should already group most
admin tasks...
--
Patrice This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robert Tarantino |
last post by:
Hello,
I am trying to find a way to create a scheduled task or
service that will copy my local profile folders
under "Documents and settings" to a network drive. This
would allow me to restore...
|
by: giloosh99 |
last post by:
Hello,
Im grabbing tables via VB code using visual foxpro ODBC drives.
The tables directory is in a mapped network drive. The code works fine
and does the job, however if the computer is idle for...
|
by: brian.oneil2 |
last post by:
Is there a way to install this onto a network file share and allow a
team to access it? I would say share a CD from a networked CD drive,
but there are multiple CD's that would have to be inserted....
|
by: Lam |
last post by:
HI
anyone knows how can I open a mapped network file in C#?
I try string file = @"T:\file.txt"; it shows me the error: "Could not find
a part of the path"
but if I copy the file to my C dirve,...
|
by: Nirosh |
last post by:
Hi All,
Can any one suggest me a best way to do this ..
I have a thrid party tool "EXE" that we need to use with our web service to
manipulate some complex XML files, which reside in a...
| |
by: James N |
last post by:
My ASP.NET application needs read/write permissions for drive "Z:",
which is mapped to my Linksys Gigadrive (Network Attached Storage...if
anyone is familiar with that).
If I configure the...
|
by: .Net Believer |
last post by:
I using the routine below to copy file to a network drive for a regular
backup process. Before calling this routine I using another function to check
the presence of the LAN connection and the...
|
by: deiopajw |
last post by:
I have a Back end database on a network drive.
The copies of the front end are located on individual pc's (in their C
drive). The problem arises when a laptop user naturally hooks up to the...
|
by: Niyazi |
last post by:
Hi,
I created application that store the data in SQL SERVER that reside on
network. The client also use this application to access the resources
provided with application. But is the client want...
|
by: danasegarane |
last post by:
Hi all I want to map a network drive. If the user has access to that
site then that path will map automatically. If the user doesnt have any rights
the i need to get the username and pwd from the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |