Sign in to follow this  
Followers 0

Whats gone wrong ?

4 posts in this topic

I'll try and picture the situation for you.

I have some laptops which all logon to a domain [2003]. When a user logs onto the laptop they will do so but will only have the choice of one ID. The reason for this is that the laptops logon to a wireless AP and because the profile is mandatry and some of the profile is re-directed to the laptop it can be quite large in size. So having different users logging on say for the first time takes a long time because the profile is being created on the users home drive and the laptop. So to speed things up I decided a user has to use the specific ID for that laptop.

Now over this week with the aid of people on the forum I have knocked up a app which when a user triggers it, produces a combo box with a list of users in, they click on their ID, it then prompts them for their password and it then deletes the current n: drive and then maps their n: drive - [ so they can save data to their n: drive ] - now all goes well up until the vital part of mapping to their n: drive. The current n: drive is deleted and the script runs but then fails to map to their drive. There is no error, the script just ends but without mapping the drive. Now all I can think of is this is maybe a security aspect as the script is maybe still using the cached password from the laptop logon ? I thought though that stating the relevant user ID with the correct password in the DriveMapAdd would do but obviously not !!

What I may try tomorrow is maybe a RunAsSet as either a local admin user or as the domain admin during the DriveMapAdd part to see if that will make a difference.

What I am hoping though is that someone may have the answer or a possible reason why - Here is hoping !! And here is the script:

; AutoIt Version:     3.1.1
; Language:         English
; Platform:         WinXP
; Author:             Matt  
; Script Function:  Script that Maps a drive to a users N: drive
; Version:

#include <GuiConstants.au3>

GUICreate("Select User", 250, 66)

$combo = GUICtrlCreateCombo("", 16, 8, 225, 21)
GUICtrlSetData($combo, "")
$selectbutton = GUICtrlCreateButton("Select", 100, 40, 60, 20)
$userlist = IniReadSection("r:\matt\usersini.ini", "Users")
If @error Then
    MsgBox(4096, "", "Error occured, probably no INI file.")
    For $i = 1 To $userlist[0][0]
        $tmp = $userlist[$i][1] & "|"
        GUICtrlSetData($combo, $tmp)
While 1
    $msg = GUIGetMsg()
        Case $msg = $GUI_EVENT_CLOSE
        Case $msg = $selectbutton
            $user = GUICtrlRead($combo)
            $password = InputBox("Security Check", "Enter your password.", "", "*")
            $drivemapuser = "\\server\" & $user
            DriveMapAdd("n:", $drivemapuser, 8, $user, $password)

Share this post

Link to post
Share on other sites

Thanks I'll take a look, it would be nice to get my code working though !!

I just stuck in a RunAsSet before the DriveMapAdd and it made no difference. :P

Looks like my laptop is about to get chucked out of the window again...

you might want to look at my DriveExplorer, has the code in it for mapping/unmapping drives with username/password

Share this post

Link to post
Share on other sites

I've solved this by using the DNS name of the server instead of the netbios name - something to remember in the future !!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0