Solved

Mapping drive to alternate system

Posted on 2013-11-08
6
761 Views
Last Modified: 2014-03-11
I need to map a drive to an alternate system that uses different credentials than windows does. I know I can do the mapping with a net use line in a bat file, however that requests the username / password via commend prompt. I was wondering if anyone had a way to do the mapping via script on Windows 7 that would request the login credentials using the windows security GUI?

 
Windows Security GUI
0
Comment
Question by:sconnaug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 6

Expert Comment

by:RaithZ
ID: 39634549
You can include the username and password in the net use command to map it that way.  You just need to add the password by itself before the /USER:domain\username like this:

net use F: \\servername\path password /USER:domain\username

That is assuming you are ok with putting the credentials in the batch file.

If that's not your style, then you could use VB Script to run the same net use command in the background while popping up windows asking for username and password as suggested here:

http://superuser.com/questions/421740/forcing-a-login-script-to-prompt-for-credentials
0
 

Expert Comment

by:cmcgarity-IT
ID: 39634625
Another alternative would be to utilize AutotIt to create the script. The AutoIt function 'DriveMapAdd' handles this nicely. Here is the syntax:

DriveMapAdd("T:", "\\server2\share", 0, "domainname\username", "password")

Where "T" is the letter to map, "\\server2\share" is the servername and share, the '0' makes it persistant, and the rest explains itself.

See this page for complete usage:
http://www.autoitscript.com/autoit3/docs/functions/DriveMapAdd.htm

AuotIt Rocks for this type of task. One word of caution, safegaurd the script, as it will contain a clear text copy of the user's password.
0
 

Author Comment

by:sconnaug
ID: 39634657
I failed to mention the script cannot include the user ID or password, but needs to prompt the user for it. The password changes every 45 days which would be an admin nightmare, not to mention that security would blow a gasket putting that in a script.

I certainly can write a VB script that would have input fields for user name then password. I just thought someone may know a way to utilize the standard windows prompt that the users are familiar with.
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 26

Expert Comment

by:Thomas Zucker-Scharff
ID: 39634715
I tried an autoit script that was linked to and it doesn't seem to work - anyone have any ideas?  I enter credentials that should work and then click okay, but nothing happens.

#include <C:\Program Files\AutoIt3\Include\GuiConstants.au3>
#include <C:\Program Files\AutoIt3\Include\EditConstants.au3>

$gui = GuiCreate("Authenticate",120,170)

GUICtrlCreateLabel("Username:",10,10,50,20)
$username = GUICtrlCreateInput("",10,35,100,20)
GUICtrlCreateLabel("Password:",10,70,50,20)
$password = GUICtrlCreateInput("",10,95,100,20,$ES_PASSWORD)

$go = GuiCtrlCreateButton("OK",10,130,50,25)
$cancel = GuiCtrlCreateButton("Cancel",60,130,50,25)

GUISetState()
Do
    $msg = GUIGetMsg()

    If $msg = $go Then
        DriveMapAdd ("Y:","\\aecc\Zdrive",0,$username,$password)
        Exit
    EndIf

    If $msg = $cancel Then
        Exit
    EndIf

Until GUIGetMsg() = $GUI_EVENT_CLOSE
GuiDelete($gui)
0
 

Accepted Solution

by:
sconnaug earned 0 total points
ID: 39910870
We finally just used a bat file with a net use command and had the user exicute it and enter their user name / password in the command prompt when they needed access to the resource. Not what we were hopeing for but it does work and the users havn't complained too much.
0
 

Author Closing Comment

by:sconnaug
ID: 39919971
Other solutions offered included embedding a user name / password which was unacceptable under our security policies. The solution I entered is not as elegant as we might have liked but it does work.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Suggestions for career in IT 11 98
Can CPU usage be related to low memory? 8 83
security id structure is invalid 2 160
Performance monitor user data collector set error 6 96
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question