TexasJohn Posted March 4, 2011 Share Posted March 4, 2011 I am Very new to AutoIT (two days) and I need to create a procedure that will check to see if a drive/folder (AD Home Directory) and the general share drive is mapped and If not, map the drives for the user. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 4, 2011 Share Posted March 4, 2011 DriveGetDrive() DriveMapGet() DriveMapAdd() See help file. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
TexasJohn Posted March 6, 2011 Author Share Posted March 6, 2011 How do I pass the users AD user name to the script? Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 6, 2011 Share Posted March 6, 2011 (edited) The user and logon domain running the script is available as a macro; see help file: MsgBox(64, "Domain\User", "Domain: " & @LogonDomain & "\" & @UserName & @CRLF & _ "DNS Domain: " & @LogonDnsDomain) Edited March 6, 2011 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
TexasJohn Posted March 6, 2011 Author Share Posted March 6, 2011 What is the variable for HomeDirectory, DriveMapAdd("X:", @HomePath) is not working. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 6, 2011 Share Posted March 6, 2011 Display the value you get with something like this: MsgBox(64, "Home sweet home...", "@HomeDrive: " & @HomeDrive & @CRLF & _ "@HomePath: " & @HomePath & @CRLF & _ "@HomeShare: " & @HomeShare) Now compare those results with what you would use to manually map it on a command line with NET USE. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
TexasJohn Posted March 6, 2011 Author Share Posted March 6, 2011 OK, I's still not getting it. I need to pass the AD home directory, not the home directory on the local machine. I can't find anything in the help that talks to that. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 6, 2011 Share Posted March 6, 2011 So that means you are running the script logged on as a local user? Is the computer a member of the domain? Are you going to input the domain via an input box, ini file entry, registry key? You are being very stingy with information on what you want to do. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
TexasJohn Posted March 6, 2011 Author Share Posted March 6, 2011 What we have is some Police Toughbooks that the offices log into and then VPN in to the network. At that point They have missed the login group police that maps their home directory. Link to comment Share on other sites More sharing options...
TexasJohn Posted March 6, 2011 Author Share Posted March 6, 2011 Yes: thee user logs in via cached credentials locally Yes: the computers are members of the domain. Everyone is part of the same domain, I don't want them to have to enter anything. If I were out there with them, I would just open explorer - tools - map drive and browse to there home directory and map it. But these are cops and that seems to be too much trouble. Link to comment Share on other sites More sharing options...
TexasJohn Posted March 7, 2011 Author Share Posted March 7, 2011 Below is what I am trying to do =============================================================== @echo off IF EXIST X:\ GOTO DELETE_X :DELETE_X NET USE X: /DELETE GOTO MAP_HOME IF NOT EXIST X:\NUL GOTO MAP_HOME :MAP_HOME NET use x: \\srvvmfs1\userhome\%username% ECHO DRIVE X: IS READY GOTO END :END Link to comment Share on other sites More sharing options...
royalmarine Posted March 7, 2011 Share Posted March 7, 2011 (edited) Below is what I am trying to do =============================================================== @echo off IF EXIST X:\ GOTO DELETE_X :DELETE_X NET USE X: /DELETE GOTO MAP_HOME IF NOT EXIST X:\NUL GOTO MAP_HOME :MAP_HOME NET use x: \\srvvmfs1\userhome\%username% ECHO DRIVE X: IS READY GOTO END :END Run("cmd") WinWaitActive("cmd") Send("net use x: \\computer ip\folder") Sleep(200) Send("{ENTER}") Sleep(1500) Send("username") Sleep(500) Send("{ENTER}") Sleep(1000) Send("password") Sleep(1500) Send("{ENTER}") Sleep(300) Send("exit") Sleep(500) Send("{ENTER}") WinWaitClose("cmd") Sleep(300) MsgBox(0, "connected", "Connected Succesfully") Run("cmd") Sleep(300) Send("net use x: /delete") Sleep(300) Send("{ENTER}") Sleep(300) Send("exit") Sleep(300) Send("{ENTER}") Sleep(200) WinWaitClose("cmd") Sleep(500) MsgBox(0, "Disconnected", "Disconnected Succesfully") here's something i used before. its basic as hell, but it worked fine. Edited March 7, 2011 by royalmarine Link to comment Share on other sites More sharing options...
TexasJohn Posted March 7, 2011 Author Share Posted March 7, 2011 If I understand the snipet correctly, All I will really need is Run("cmd") WinWaitActive("cmd") Send("net use x: \\srvvmfs1\userhome\%username%") Sleep(200) Send("{ENTER}") Each user will have already entered his AD password and user name to get into his workstation using cashed AD credentials in has workstation. Link to comment Share on other sites More sharing options...
TexasJohn Posted March 8, 2011 Author Share Posted March 8, 2011 The below gets me the DOS window but nothing after that. What Im I missing here? If I take out the WinWaitActive("cmd"), it seems to work some of the time. Run("cmd") WinWaitActive("cmd") Sleep(300) Send("net use x: /delete") Sleep(300) Send("{ENTER}") sleep(300) Send("net use x: \\SRVVMFS1\userhome\%username%") Sleep(200) Send("{ENTER}") MsgBox(0, "connected", "Done!") Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 8, 2011 Share Posted March 8, 2011 If the logged in user's credentials are sufficient to access the share, then all you should need is: $sDrvType = DriveGetType("X:") If Not @error Then $sDrvPath = DriveMapGet("X:") MsgBox(64, "X: Mapped", "X: is already mapped as type = " & $sDrvType & "; path = " & $sDrvPath) Else If DriveMapAdd("X:", $sMapPath, 8) Then MsgBox(64, "X: Mapped", "Successfully mapped X: to " & $sMapPath) Else MsgBox(16, "Error", "Failed to map X: drive; @error = " & @error) EndIf EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
TexasJohn Posted March 10, 2011 Author Share Posted March 10, 2011 We initially had a problem with a missing global veritable $sMapPath. I guessed at what is should be but I'm obviously wrong. I get the following error "Failed to map X drive: @error =1 $s$sDrvType = DriveGetType("X:") $sMapPath = "\\srvvmfs1\userhome\username" If Not @error Then $sDrvPath = DriveMapGet("X:") MsgBox(64, "X: Mapped", "X: is already mapped as type = " & $sDrvType & "; path = " & $sDrvPath) Else If DriveMapAdd("X:", $sMapPath, 8) Then MsgBox(64, "X: Mapped", "Successfully mapped X: to " & $sMapPath) Else MsgBox(16, "Error", "Failed to map X: drive; @error = " & @error) EndIf EndIf Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now