3

Scenario: Office is transferring from one server to another, on a different domain than is currently being used. Net use login scripts fail automatically due to improper authentication.

What I need A login script to map drives to the new server, using different credentials than what the user logs in with. Cannot put username and password for each user in the login script, it needs to prompt and allow a user to modify the domain/username and password to gain access to it.

What it would look like Login script runs, opens a window prompting for the user to input alternative credentials, user inputs required credentials, drive maps properly.

I have done some google searches, and looked into vbs net use scripting, but it looks like it all requires the user's username and password to be put into the specific login batch file.

Thoughts?

2 Answers2

3

With VBS scripting, you could use something like

$username = InputBox("Type your username", vbOKOnly)
$password = InputBox("Type your password", vbOKOnly)
Canadian Luke
  • 24,640
1

Here is an example of how you would do that in AutoIt. This will prompt for credentials and then persistently map a drive based on those credentials.

#include <GuiConstants.au3>
#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 ("K:","//path/to/share",1,$username,$password)
    EndIf

    If $msg = $cancel Then
        Exit
    EndIf

Until GUIGetMsg() = $GUI_EVENT_CLOSE
GuiDelete($gui)
MaQleod
  • 13,258