Hi All
I am working on a script that will map a network share remotely. Since network shares are mapped under user context it will require the credentials of the user.
To avoid asking the user for these explicitly, I wrote a script that will prompt them for their Username and Password through InputBox (See Below.)
To keep the password as secret as possible I generate a random string and use _StringEncrypt() passing all info through an .ini file.
The script uses PsExec on the local machine to execute the InputBox script on the remote machine.
However, when the script is executed the prompts show up black. Information can still be typed in the boxes but you can't see anything. (See attachment)
I've searched through the forum a few times and found a couple of posts with similar problems but they were resolved using PsExec...since I am already doing that I am not sure where to go from here.
Any thoughts would be appreciated and any advice on better code is more than welcome.
Main code that will transfer the InputBox and execute the needed commands:
Code for the InputBox:
I am working on a script that will map a network share remotely. Since network shares are mapped under user context it will require the credentials of the user.
To avoid asking the user for these explicitly, I wrote a script that will prompt them for their Username and Password through InputBox (See Below.)
To keep the password as secret as possible I generate a random string and use _StringEncrypt() passing all info through an .ini file.
The script uses PsExec on the local machine to execute the InputBox script on the remote machine.
However, when the script is executed the prompts show up black. Information can still be typed in the boxes but you can't see anything. (See attachment)
I've searched through the forum a few times and found a couple of posts with similar problems but they were resolved using PsExec...since I am already doing that I am not sure where to go from here.
Any thoughts would be appreciated and any advice on better code is more than welcome.
Main code that will transfer the InputBox and execute the needed commands:
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=test\netdrive.exe #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <String.au3> $hname = InputBox("Hostname/Ip", "Please enter the Hostname or IP for the Machine: ") FileCopy("C:\netdrive_user.exe", "\\" & $hname & "\C$\") $pwd = "" Dim $aSpace[3] $digits = 15 For $i = 1 To $digits $aSpace[0] = Chr(Random(65, 90, 1)) ;A-Z $aSpace[1] = Chr(Random(97, 122, 1)) ;a-z $aSpace[2] = Chr(Random(48, 57, 1)) ;0-9 $pwd &= $aSpace[Random(0, 2, 1)] Next IniWrite("\\" & $hname & "\C$\netdrive.ini", "ePsswd", "ePass", $pwd) RunWait("C:\Windows\Support\PSExec.exe \\" & $hname & Chr(32) & "-i" & Chr(32) & "C:\netdrive_user.exe") ;RunWait("\\" & $hname & "\C$\netdrive_user.exe", "\\" & $hname & "\C$\") $pwssd = _StringEncrypt(0, IniRead("\\" & $hname & "\C$\netdrive.ini", "Password", "Password", "Not Found"), $pwd, 1) $uname = IniRead("\\" & $hname & "\C$\netdrive.ini", "Username", "UName", "Not Found")
Code for the InputBox:
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=..\..\..\..\..\netdrive_user.exe #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Misc.au3> #include <String.au3> $uname = InputBox("UserName", "Please Enter your Username: ") $psswd = InputBox("Password", "Please Enter your Password: ", "", "*") $ePsswd = _StringEncrypt(1, $psswd, IniRead("C:\netdrive.ini", "ePsswd", "ePass", "")) IniWrite("C:\netdrive.ini", "Username", "UName", $uname) IniWrite("C:\netdrive.ini", "Password", "Password", $ePsswd)